Apache not including site (virtual host) config
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 videos on Youtube
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, 2022Comments
-
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 withapache2ctl -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
ismydomain.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 about 10 yearsWhat is the name of your config file and link ?
-
Jerodev about 10 yearsmy 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 about 10 yearsrelated: askubuntu.com/questions/362682/…
-
-
Jerodev about 10 yearsI 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 about 10 yearssimply paste that line above in the /etc/apache2/ports.conf file and restart apache2
-
Jerodev about 10 yearsIt 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 about 10 yearsThe test.mydomain.eu is some placeholder for a real domain or you defined it locally on /etc/hosts file ?
-
Jerodev about 10 yearsThis is a placeholder for a real domain.
-
Panther about 10 yearsThis is a common problem which is why I asked for the name of your config files, but I see you got it sorted.
-
sjas over 9 yearsYou mean end in
.conf
, dont' you?