Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable all apache virtual hosts?

I'm writing a shell script to do some web server configuration. I need to disable all currently active virtual hosts. a2dissite doesn't accept multiple arguments, so I can't do

a2dissite `ls /etc/apache2/sites-enabled`

Should I use find? Is it safe to manually delete the symlinks in /etc/apache2/sites-enabled?

like image 856
Christian Oudard Avatar asked Oct 08 '08 14:10

Christian Oudard


1 Answers

You can just do the following:

sudo a2dissite '*'

or:

sudo a2dissite

and it will prompt you for the ones you want to disable.

When you have finished disabling sites, restart apache2 server:

sudo systemctl restart apache2

or just reload apache configuration without a full restart:

sudo service apache2 reload
like image 153
Rob Avatar answered Sep 19 '22 14:09

Rob