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 #1
- Join Date
- Nov 2009
Apache VirtualHost Help
my httpd.conf is as follows (changed the domain and user names for security)
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 ?
- 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:
domain2.com should return domain2. But www.domain2.com will return domain1.
you can use ServerAlias, together with wildcards.
ServerName www.domain2.com ServerAlias domain2.com ServerAlias *.domain2.com