Apache not including site (virtual host) config

7,819

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
Share:
7,819

Related videos on Youtube

Jerodev
Author by

Jerodev

I'm a certified Laravel developer who likes to work with Laravel, TailwindCSS and Vue.js. Occasionally I try some things in Golang. In my spare time, I work on multiple projects including but not limited to TableTopFinder & Breakout.

Updated on September 18, 2022

Comments

  • Jerodev
    Jerodev over 1 year

    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?

    • Panther
      Panther about 10 years
      What is the name of your config file and link ?
    • Jerodev
      Jerodev about 10 years
      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.
    • Dan
      Dan about 10 years
  • Jerodev
    Jerodev about 10 years
    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?
  • cioby23
    cioby23 about 10 years
    simply paste that line above in the /etc/apache2/ports.conf file and restart apache2
  • Jerodev
    Jerodev about 10 years
    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
  • cioby23
    cioby23 about 10 years
    The test.mydomain.eu is some placeholder for a real domain or you defined it locally on /etc/hosts file ?
  • Jerodev
    Jerodev about 10 years
    This is a placeholder for a real domain.
  • Panther
    Panther about 10 years
    This is a common problem which is why I asked for the name of your config files, but I see you got it sorted.
  • sjas
    sjas over 9 years
    You mean end in .conf, dont' you?