PDA

View Full Version : [ubuntu] Correct way to restart apache daemon



PeterTaps
October 7th, 2016, 07:12 AM
Environment: Ubuntu 16.04

It appears there are multiple ways to restart apache2

$ sudo /etc/init.d/apache2 restart

$ sudo systemctl restart apache2

$ sudo service apache2 restart

They all seem to work. However, I am wondering if there is a recommended way to restart apache2 (or any other daemon I guess).

Thank you in advance for your help.

Regards,
Peter

sisco311
October 7th, 2016, 08:43 AM
All three commands will do the same thing. Ubuntu 16.04 defaults to systemd, so systemctl is the appropriate command to control it. The other two commands are available for backward compatibility with the old init systems used by earlier versions of Ubuntu, namely Upstart and SystemV init.