I am attempting to host multiple sites on a single server by using virtual hosts however I am having a bit of an issue.
A bit of info before I begin,
-I am using Ubuntu Server 12.04
-I am using Apache2
-I have two domains and two sites, stored in /var/www/site1 and /var/www/site2
I have put this in my httpd.conf file and from what I understand it should have worked, allowing domain1 to go to site1 and domain2 to go to site2 but instead domain1 and domain2 go to site1 only.
NameVirtualHost *80 <VirtualHost *:80> DocumentRoot "/var/www/site1" ServerName domain1.com ServerAlias www.domain1.com </VirtualHost> <VirtualHost *:80> DocumentRoot "/var/www/site2" ServerName domain2.com ServerAlias www.domain2.com </VirtualHost>
As I say, it just loads up site1 regardless of which domain I put in. If I swap them around so domain2 is the first virtual host then it shall load up that one only.
What am I doing wrong?
Thank you in advance!