Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I've configured two Virtual Hosts using a single IP and following the documentation. Here the conf:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server (/etc/httpd/conf/httpd.conf:1019)
         port 80 namevhost (/etc/httpd/conf/httpd.conf:1019)
         port 80 namevhost (/etc/httpd/conf/httpd.conf:1024)

If I point my browser to or, I can see the correct corresponding page. If I point to the server name, I see the index.html, and not the index.html in the corresponding DocumentRoot (/var/www/html). Is this the correct behaviour?

share|improve this question
show us your actual apache configuration, I'm not sure what you have given us. – X Tian Feb 9 '14 at 15:28
That was the output of httpd -S. – ludiegu Feb 11 '14 at 14:40

1 Answer 1

Yes, the behavior changes when you enable virtual hosts from serving the global DocumentRoot directory to serve the first defined virtual host.

You should set a first virtual host (that appears in your configuration) to serve /var/www/html and then one for host1 and another for host2.

share|improve this answer
Makes sense. And what if I would not use the DocumentRoot /var/www/html directory? Should I comment it in the httpd.conf? – ludiegu Feb 11 '14 at 14:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.