If you had no VirtualHosts defined before, requests to the server will filter through the standard configuration in httpd.conf/apache2.conf.
This will mean that the hosts will bind to whatever's specified on the
Listen line, and be served from the standard
DocumentRoot specified in the Apache config file (by default this is /var/www/html on Redhat-based systems).
Once you start adding
NameVirtualHost directives, instead of following these conventions, requests to an unspecified
ServerName will instead filter-through to the first specified
You can see this if you dump the Apache configuration with
httpd -S (
apache2 -S on debuntu):
[root@server]$ httpd -S
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server somesite.com (/etc/httpd/conf/httpd.conf:1050)
port 80 namevhost somesite.com (/etc/httpd/conf/httpd.conf:1050)
port 80 namevhost othersite.org (/etc/httpd/conf/httpd.conf:1074)
You basically just need to define a VirtualHost which matches your default configuration, i.e set the
DocumentRoot to whatever the main config
DocumentRoot is, and configure the basic directives again so they're not overwritten. You need to place this VirtualHost as the first one in the Apache configuration.