On Linux, Apache HTTP Server is an open-source, most frequently used web server. It is used to deliver the requested web pages or web content from the internet. The “Apache” server must be restarted after performing some tasks to show effective results when any changes are made.
This guide will list down possible ways to restart Apache on Linux with the following guidelines:
How to Restart Apache On Debian/Ubuntu?
The “systemd” is an init (initialization) system of the Debian/Ubuntu-based distributions to start, stop, restart, and reload the System. The procedure is done through the “systemctl” command:
Restart Apache Service
Type the “restart” keyword with the “systemctl” command to restart the apache server quickly:
$ sudo systemctl restart apache2.service
The command executed without any error that shows the “apache2” server is restarted.
View Apache Status
Once again, run the “systemctl status” command to check the current state of the “apache2” server:
$ sudo systemctl status apache2.service
The current status of the apache2 service on Ubuntu is “active (running)”
How to Restart Apache On CentOS/Fedora/RHEL?
The “systemctl” command also works on the CentOS, Fedora, and RHEL latest versions to restart the apache server. The same steps are followed as performed for Debian/Ubuntu distributions.
Restart Apache Server
Execute the “systemctl” command with the “restart” keyword to restart the apache server:
$ sudo systemctl restart httpd.service
Check Apache Status
Check the Apache server status again using the “systemctl” command:
$ sudo systemctl status httpd.service
The “systemctl” command line tool helps to restart the Apache server. The command “sudo systemctl restart apache2.service” is used to restart Apache on Debian/Ubuntu-based distros, while the command “sudo systemctl restart httpd.service” is to restart Apache on CentOS/Fedora/RHEL.