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 am running Linux mint and I'm trying to setup up a virtual host with apache.

I have added the following file in /etc/apache2/sites-available/ ( it's copied from the 'default' file in that directory)

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /home/chris/Projects/web/testsite

        <Directory /home/chris/Projects/web/testsite>
            Allow from all
            AllowOverride All
            Order allow,deny

        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 also added an entry in my hosts file (/etc/hosts) which would be:

I've also enabled the site and reloaded the apache service with:

a2ensite testsite 
service apache2 reload

However when I browse to it's serving pages from /var/www/ instead of /home/chris/Projects/web/testsite.

What am I doing wrong?

share|improve this question
try replacing what you have in default with what you have in testsite and realoading. if that works, it means that what is in the default vhost file is winning for some reason over your new site when receiving a request for the – Hersheezy Sep 11 '12 at 18:38
up vote 0 down vote accepted

A few things I would check:

  • Ensure that you have a "NameVirtualHost *:80" in your config. If the "*:80" is different it may conflict with the value in "VirtualHost" (in general there are less issues if they are the same).
  • Ensure you don't have other "VirtualHost" defined somewhere that may be conflicting with this one (I assume everything in "sites-available" as well as any other Apache config file).
  • Check the error log to make sure nothing "bad" is happening. Enabling and checking the access log may also be useful.
  • Double check that the files/content in the two directories is what you think it is. If you have them somehow mixed up it could be working as expected.
  • Stop and start Apache service. In theory reloading should work but just in case (it wouldn't be the first time I've seen reloading fail but stopping/starting work).

If you run through all this and still can't seem to get what you want I would create a minimal set of Apache configs (move all existing configs out and create temporary ones) and start changing things a step at a time to see where things are going wrong.

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.