I was not sure when a client asked me “How do I gracefully restart Apache on my Linux server?” This prompt me to brew another coffee at home and then find how to reload Apache httpd config without restarting Apache server.
There are several methods for this depending on your Linux version:
apachectl
systemctl
service (older Linux distros)
Using apachectl to reload Apache
If you like to run a config test before reloading the config settings. You can do this with apachectl command:
apachectl configtest
and if everything is OK you can reload Apache httpd config next:
apachectl -k graceful
Using systemctl to reload Apache
This works for Linux distros running systemd. Syntax is easy:(you may need sudo in front of the command)
systemctl reload httpd
or
systemctl reload apache2
Using service or /etc/init.d to reload Apache httpd
You can also reload Apache in older Linux distros using System V init. Try these commands: (again you may need sudo in front of the command)
service httpd graceful
or
/etc/init.d/httpd graceful
or
/etc/init.d/apache2 reload (for Debian family)
Hope this is helpful. Contact me if you have any questions. Also, visit my shop where I feature cool T-shirts and coffee mugs I designed.
Here are some examples from my T-shirt and coffee mugs shop. Let me know what you think. Thanks.
- grep command Short-Sleeve T-Shirt Unisex$25.00
- apt install Coffee Mug$19.95
- Code with Coffee Short-Sleeve Unisex T-Shirt$24.00 – $28.00