Results 1 to 2 of 2
Hey guys, having trouble with virtual hosts on my CentOS run Apache2 server.
my httpd.conf is as follows (changed the domain and user names for security)
Code:
NameVirtualHost *:80
<VirtualHost ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 11-07-2009 #1Just Joined!
- Join Date
- Nov 2009
- Posts
- 11
Apache VirtualHost Help
Hey guys, having trouble with virtual hosts on my CentOS run Apache2 server.
my httpd.conf is as follows (changed the domain and user names for security)
Now domain1.com shows the correct files however by going to domain2.com it is showing the files for domain1.com.....Code:NameVirtualHost *:80 <VirtualHost *:80> DocumentRoot /home/user1/domain1.com/public_html ServerName domain1.com <Directory /> AllowOverride All </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot /home/user2/domain2.com/public_html ServerName domain2.com <Directory /> AllowOverride All </Directory> </VirtualHost>
i tried in a different browser incase it was showing a cached page from a previous viewing but its not.
Any suggestions ?
Cheers.
- 11-09-2009 #2
the config looks ok.
What comes to mind:
Any servername, that is not explicitly written in the config will default to the first server.
In your example:
To overcome that,Code:domain2.com should return domain2. But www.domain2.com will return domain1.
you can use ServerAlias, together with wildcards.
ie:
Code:ServerName www.domain2.com ServerAlias domain2.com ServerAlias *.domain2.com


Reply With Quote
