How to rename default-ssl.conf in Apache 2.4

apache-2.4mod-ssl

I'm running Apache 2.4 on Ubuntu. I'm trying to renamedefault-ssl.conf, but I can't get it to work.

Here is what works.

If I enable the SSL module

a2enmod ssl

and the site configuration file

a2ensite default-ssl.conf

and start httpd

service apache2 start

then httpd serves on port 443 SSL-encrypted contents from /var/www/html, exactly as expected. So far so good.

Here is what doesn't work.

If I rename the default configuration file

mv /etc/apache2/sites-enabled/{default-ssl.conf,foobar}
service apache2 restart

then httpd sends clear text responses on port 443, and responds to "GET /" with an index of /var/www.

What makes the name default-ssl.conf so special? How can I rename it without breaking everything?

Best Answer

You need to make sure the new configuration name ends with .conf

As this is only a symlink created by the a2ensite command, you probably want to rename to actual configuration file:

a2dissite default-ssl
mv /etc/apache2/sites-available/default-ssl.conf \
   /etc/apache2/sites-available/foobar.conf
a2ensite foobar
service apache2 reload