Auto restart Apache after every .conf file change

Auto restart Apache after every .conf file change

Shown below are the steps to auto-restart Apache after every change made to the .conf file

If ‘incron’ is already installed on your system, then skip Steps 1 and 2.

$ sudo apt-get install incron

$ sudo vi /etc/incron.allow

Add <USERNAME> at the end of this file and save.

$ sudo incron -e

Once the incrontab is open in editable mode, add the following line at the end of the content :

/etc/apache2/apache2.conf IN_MODIFY /usr/sbin/service apache2 restart

save the file and exit the file.

From now on, every change in the /etc/apache2/apache2.conf file will trigger /usr/sbin/service apache2 restart to restart the Apache server. You can also use incron to perform other useful tasks.

Post Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like