I've got a standard build of RHEL6 and I used to be able to browse to the server's DocumentRoot
using the IP address.
I've since added these two vhosts (just the top section is shown). For some reason, now when I access the server's IP address, the Vhost answers and the wrong DocumentRoot
is used.
I don't really want to explicitly define a Vhost for /var/www/html
.
Another note… I have added NameVirtualHost *:80
to httpd.conf
.
Any ideas why the vhosts are answering this?
==> axxx-http.conf <==
<VirtualHost *:80>
ServerAdmin beren@xxyy.com
ServerName xxyy.com
ServerAlias www.xxyy.com
DocumentRoot /var/www/site
<Directory /var/www/site>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
==> axxx-ssl.conf <==
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
ServerName xxyy.com
ServerAlias www.xxyy.com
ServerAlias admin.xxyy.com
DocumentRoot /var/www/site
<Directory /var/www/site>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Best Answer
When you start to use virtual hosts on a webserver you have to make a virtual host for the normal server too. If you don't create one, the first virtual host defined will be the default one for any connections to the server not matched by another virtual host ServerName or ServerAlias directive.
Check the section "Main host goes away" on this URL for this explanation:
http://httpd.apache.org/docs/2.2/vhosts/name-based.html