1

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/www.x.com

#
#  Example.com (/etc/apache2/sites-available/www.x.com)
#
<VirtualHost *:80>
        ServerAdmin [email protected]
        ServerName  www.x.com
        ServerAlias x.com

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

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


        # Logfiles
        ErrorLog  /home/www/www.x.com/logs/error.log
        CustomLog /home/www/www.x.com/logs/access.log combined
</VirtualHost>

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

ServerName www.x.com

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>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

2 Answers 2

1

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

NameVirtual host *:80

on ports.conf

0

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?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .