Apache is an open-source and cross-platform HTTP server. It comes loaded with powerful features and can be further extended with a wide variety of modules.
Starting, stopping, and restarting/reloading are the most common tasks when working with an Apache webserver.
This article explain you how to start, stop, and restart Apache service on Ubuntu using the terminal.
start: Starts the Apache service.
stop: Terminates the Apache service.
restart: Stops and then starts the Apache service.
reload: Gracefully restarts the Apache service. On reload, the main Apache process shuts down the child processes, loads the new configuration, and starts new child processes.
status: Shows the service status.
To restart Apache web server use the following command:
sudo service apache2 restart
To stop Apache web server use the following command:
sudo service apache2 stop
To start Apache web server use the following command:
sudo service apache2 start
To check Apache server status (i.e. whether it is running or not) you can use the following command:
sudo service apache2 status
Start, Stop and Restart Apache on RHEL/CentOS:
Start the Apache service:
sudo systemctl start httpd
Stop the Apache service:
sudo systemctl stop httpd
Restart the Apache service:
sudo systemctl restart httpd
If you have CentOS 6 or earlier system that uses SysV, use the following commands to start, stop and restart the Apache daemon:
sudo service httpd start sudo service httpd stop sudo service httpd restart