Hi folks,
I have been trying to figure this out for a few days now and I've pulled out most of my hair. Can someone please put me out of my misery.
I need to transfer several domains from simple, managed web-hosting to a semi-dedicated VPS server so that I can get my hands dirty and get the extra control that I crave.
My server uses Debian flavoured Linux with Apache2 (I have no choice in this) and I have 3 IP addresses.
I want to implement a combined IP/Name-based virtual host configuration.
Directories sites-available and sites-enabled are both empty.
In the example (below), I have 4 sites.
Browsing to
www.site-A.com and
www.site-B.com works correctly.
Browsing to
www.site-C.com and
www.site-D.com always shows site-C.
If I change the order so that site-D appears before site-C, then browsing to either will show site-D.
I have looked everywhere for examples of combined IP/Name-based configs, but it never makes any difference.
I have set DNS so that the 4 sites point into my server:
site-A goes to 123.45.67.100
site-B goes to 123.45.67.101
site-C and site-D both go to 123.45.67.199
And here is my server configuration:
Code:
ServerName localhost
Listen 80
##### site-A.com on 123.45.67.100
<VirtualHost 123.45.67.100>
ServerName site-A.com
DocumentRoot /var/www/sites/site-A/htdocs
</VirtualHost>
##### site-B.com on 123.45.67.101
<VirtualHost 123.45.67.101>
ServerName site-B.com
DocumentRoot /var/www/sites/site-B/htdocs
</VirtualHost>
##### Multiple name-based virtual hosts on 123.45.67.199 #####
NameVirtualHost 123.45.67.199
##### site-C.com on 123.45.67.199
<VirtualHost 123.45.67.199>
ServerName site-C.com
DocumentRoot /var/www/sites/site-C/htdocs
</VirtualHost>
##### site-D.com on 123.45.67.199
<VirtualHost 123.45.67.199>
ServerName site-D.com
DocumentRoot /var/www/sites/site-D/htdocs
</VirtualHost>