Ubuntu – Apache not including site (virtual host) config

Apache2configurationvirtualhost

I have added a config file to my /etc/apache2/sites-available and added a link to /etc/apache2/sites-enabled. Yet if I restart my server and check with apache2ctl -S, I only get the virtualhost from 000-default.

root@ns00001:/etc/apache2/sites-available# apache2ctl -S
VirtualHost configuration:
*:80                   ns00001.ip-x.x.x.x.com (/etc/apache2/sites-enabled/000-default.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33

The file I have created in /etc/apache2/sites-available is mydomain.eu and contains the following text:

<VirtualHost *:80>
        ServerName test.mydomain.eu
        DocumentRoot /var/www/test

        <Directory /var/www/test/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride AuthConfig
                Order allow,deny
                allow from all
        </Directory>
</VirtualHost>

But when I go to test.mydomain.eu I get the apache default page (It works!). So this means the 000-default takes over.
yes, I have restarted the apache2 service after changing the config.

Can someone help me with this, what am I forgetting?

Best Answer

The problem has been solved.

Apparently, in the new version of Apache, all site configs should end in .conf. I did this and the problem was solved.

This behaviour is defined by the following directive within /etc/apache2/apache2.conf:

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
Related Question