0

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?

pa4080
  • 29,831
Jerodev
  • 211
  • 1
    What is the name of your config file and link ? – Panther May 20 '14 at 18:33
  • my config file is called deviaene.eu and the link has the same name. I use the same config on another server with the same operating system and it works fine. – Jerodev May 21 '14 at 13:36
  • related: http://askubuntu.com/questions/362682/403-error-after-upgrading-to-apache2-4 – Dan May 22 '14 at 06:50

2 Answers2

2

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
pa4080
  • 29,831
Jerodev
  • 211
0

Try do disable the default site by running:

sudo a2dissite 000-default
sudo service apache2 restart

Your test.domain.eu should point to the correct documentroot location. One more thing do you have enabled NameVirtualhost in /etc/apache2/ports.conf ?

NameVirtualHost *:80
cioby23
  • 2,525
  • I have dissabled 000-default, but now the subdomain points to /var/www. I do not have a NameVirtualHost in /etc/apache2/ports.conf, how do I add this? – Jerodev May 20 '14 at 18:39
  • simply paste that line above in the /etc/apache2/ports.conf file and restart apache2 – cioby23 May 20 '14 at 18:42
  • It didn't work. and when I restarted apache2 it said the following: AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/apache2/ports.conf:1 – Jerodev May 20 '14 at 18:48
  • It seems you are running Apache 2.4 since that option works fine in Apache 2.2. What version of Ubuntu are you running? – cioby23 May 20 '14 at 18:53
  • The test.mydomain.eu is some placeholder for a real domain or you defined it locally on /etc/hosts file ? – cioby23 May 20 '14 at 18:59
  • This is a placeholder for a real domain. – Jerodev May 21 '14 at 13:34