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 made my first server following a tutorial here setting up domains on Apache2.

When I try running /etc/init.d/apache2 restart I get this error:

[Mon Oct 29 11:47:17 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
[Mon Oct 29 11:47:17 2012] [warn] NameVirtualHost *:80 has no VirtualHosts

This is my /etc/apache2/conf.d/virtual.conf

#  We're running multiple virtual hosts.
NameVirtualHost *:80

This is my /etc/apache2/sites-available/

# (/etc/apache2/sites-available/
<VirtualHost *:80>

        # Indexes + Directory Root.
        DirectoryIndex index.php index_screw.php index.html
        DocumentRoot /home/www/

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

        # Logfiles
        ErrorLog  /home/www/
        CustomLog /home/www/ combined

This is my /etc/apache2/conf.d/httpd.conf


This is my /etc/apache2/conf.d/ports.conf

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443

<IfModule mod_gnutls.c>
    Listen 443
share|improve this question
up vote 1 down vote accepted

All you have to do is to remove or comment (#)

NameVirtual host *:80

on ports.conf

share|improve this answer

As per the tutorial:-

"As with the conf.d directory each configuration file in the sites-enabled directory is loaded when the server starts - whilst the files in sites-available are completely ignored.

You are expected to create your host configuration files in /etc/apache2/sites-available, then create a symbolic link to those files in the sites-enabled directory - this will cause them to be actually loaded/read."

Did you do that?

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.