Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
<VirtualHost *:80>
    DocumentRoot /var/www/example/example

When I open the website on my browser like it is listing all the files under /var/www/example directory instead of a page!

But if I use ServerAlias it works fine just wondering what could be the problem?

share|improve this question
Please rephrase your question. What exactly doesn't work? What exactly do you expect to happen and what does happen instead? – joschi Jul 13 '10 at 5:39
up vote 1 down vote accepted

When Apache httpd receives a host name in the HTTP/1.1 Host header which no VirtualHost exists for or no Host header at all, it'll serve the first VirtualHost it encounters in its configuration. is currently not configured in your snippet, so Apache httpd will serve the default VirtualHost which probably has the DocumentRoot /var/www/.

If you want to know details you should read An In-Depth Discussion of Virtual Host Matching.

share|improve this answer

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.