Debian – a2ensite doesn’t show all sites in /etc/apache2/sites-available

apache-2.2debianvirtualhost

I just did a big reinstall of Apache2 (Debian 2.4.4-6, libapache2-mod-php5 5.5.0~rc3+dfsg) and when it reset, all of my vhosts broke. Wondering if I accidentally purged my vhost configurations, I went to check:

d8uv@ddd /etc/apache2/sites-available
$ sudo ls -l
total 32
-rw-r--r-- 1 root root  798 Jun  2 08:27 000-default.conf
-rw-r--r-- 1 root root  394 Jul  9  2012 domain1.com
-rw-r--r-- 1 root root  422 Jul 26  2012 domain2.com
-rw-r--r-- 1 root root  427 Apr 28  2010 domain3.com
-rw-r--r-- 1 root root  400 Apr 28  2010 domain4.com
-rw-r--r-- 1 root root  393 Oct 26  2010 domain5.com
-rw-r--r-- 1 root root 6432 Jun  2 08:27 default-ssl.conf

All there, so let's see if I can enable them:

d8uv@ddd /etc/apache2/sites-available
$ sudo a2ensite 
Your choices are: 000-default default-ssl
Which site(s) do you want to enable (wildcards ok)?

So, the configuration files exist, but they're not being seen by a2ensite. Perhaps vhosting is turned off in the main config file?

d8uv@ddd /etc/apache2/sites-available
$ tail /etc/apache2/apache2.conf 
# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

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

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Best Answer

Look very closely at the include statements. Do you see it yet? No?

it includes sites-enabled/*.conf, so rename your configfiles so they have the .conf extension.

Related Topic