I have a virtual machine running Apache 2 and am having the worst time attempting to set up multiple name based virtual hosts. Basically as soon as I upload and enable a new virtual host file in the sites-enabled folder the entire web server stops responding. It won't start, I can't connect to it from a web browser, and it won't start back up again until I remove the file. Here are the steps I am following:

  1. Creating a new VirtaualHost file and uploading it to etc/apache2/sites-enabled, VirtualHost file looks like the code below and is named www.glutenfreaks.com:

ServerAdmin evomoore@gmail.com ServerName www.glutenfreaks.com ServerAlias glutenfreaks.com

    # Indexes + Directory Root.
    DirectoryIndex index.php
    DocumentRoot /var/www/glutenfreaks/

    # CGI Directory
    ScriptAlias /cgi-bin/ /var/www/glutenfreaks/cgi-bin
    <Location /cgi-bin>
            Options +ExecCGI

    # Logfiles
    ErrorLog  /var/www/glutenfreaks/logs/error.log
    CustomLog /var/www/glutenfreaks/logs/access.log combined

  1. From the command line I'm then executing "a2ensite www.glutenfreaks.com"

  2. Then I reload the server: "/etc/init.d/apache2 reload"

And then everything goes boom and nothing works anymore.





what happens when you do apache2ctl configtest ? and what do you see in /var/log/apache2/error.log

  • 1
    I'm assuming you took out the necessary stuff with <VirtualHost> </VirtualHost> from your paste.. – Vid Luther Jul 22 '10 at 2:53

Your apache not responding because he can`t load his config-file.

The first thing you must do - remember if you do something else mentioned here.

The next one - #tail /var/log/apache2/error.log, if you enabled apache error log. If you don`t, enable it and start apache.

BTW, the Syntax of VirtualHost directive is <VirtualHost addr[:port] [addr[:port]] ...>...</VirtualHost> - ie <VirtualHost>...</VirtualHost>. Maybe you need write the right host?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy