Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

I have been trying to get this work for hours now. I am trying to set up virtual hosts with Apache on my VPS.

I have the following virtual host file in my sites-available folder :

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from ::1/128

I have issued the a2ensite command on the virtual host.

I have also issued the restart and reload commands. I have also stopped the Apache server and started it, using both commands, to see if Apache is in fact restarting, and it is. I have also restarted the VPS box completely.

The document root folder does exist, but the apache service still serves up the default apache page. I would prefer not to disable the default virtual host.

Am I missing a step here? Should I be adding something to my hosts file in /etc/hosts? has been added there by apache : localhost.localdomain localhost

Any help on this would be greatly appreciated.

share|improve this question
up vote 5 down vote accepted

You need a ServerName directive in the <VirtualHost> block, so that Apache knows when to serve content from that virtual host.

share|improve this answer
Thank you womble, this solved my issue. – Dave O Dwyer Aug 5 '12 at 1:03


NameVirtualHost *:80

to your apache config also, your file looks have no


more docs here:

share|improve this answer
The OP only provided the vhost definition; it's a fair bet the NameVirtualHost is elsewhere in the config. – womble Aug 5 '12 at 0:48

I also had the problem show up when I defined DocumentRoot before setting ServerName in my <VirtualHost ...> directive.

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.