Ubuntu – How to enable all site confs with a2ensite (while passing over 000-default.conf && default-ssl.conf)

Apache2automationconfigurationvirtualhost

I use Ubuntu server 16.04.2 with Apache2, on which I store my personal websites.

To enable all my conf files under /etc/apache2/sites-available (besides 000-default.conf and ssl-default.conf), I went to /var/www/html and executed a2ensite.

I was then told:

Your choices are: 
000-default default-ssl domain.tld1 domain.tld2 domain.tld3 domain.tld4 
Which site(s) do you want to enable (wildcards ok)?

I then did Ctrl+C aiming to execute something else.

I am looking for a way to automatically enable all site confs, without noting a specific one — I just want to run a command that will enable all site confs that I myself added.

Best Answer

Might aswell just use find on your config directory.

find /etc/apache2/sites-available/ -type f -and -not -name "*default*" -exec a2ensite {} \;

This finds all your configuration files that are not having "default" in their name and activates them.

Related Question