YouTube Icon

Code Playground.

How to Start, Stop, or Restart Apache

CFG

How to Start, Stop, or Restart Apache

Apache is an open-source and cross-stage HTTP worker. It comes stacked with amazing highlights and can be additionally stretched out with a wide assortment of modules. 

In the event that you are a designer or framework manager, the odds are that you're managing Apache consistently. 

Beginning, halting, and restarting/reloading are the most well-known errands when working with an Apache webserver. The orders for dealing with the Apache administration are diverse across Linux circulations. 

The greater part of the ongoing Linux disseminations are utilizing SystemD as the default init framework and administration administrator. More established appropriations depend on SysVinit and utilizing init contents to oversee administrations. Another distinction is the name of the administration. In Ubuntu and Debian, the Apache administration is named apache2, while in Red Hat based framework, for example, CentOS, the name of the administration is httpd. 

In this guide, we'll disclose how to begin, stop, and restart Apache on the most mainstream Linux dispersions. 

Before You Begin

The directions accept that you are signed in as root or client with sudo advantages. 

Both SystemD administration units and SysVinit content takes the accompanying contentions to deal with the Apache administration: 

  • start: Starts the Apache administration. 
  • stop: Terminates the Apache administration. 
  • restart: Stops and afterward begins the Apache administration. 
  • reload: Gracefully restarts the Apache administration. On reload, the principle Apache measure closes down the kid measures, stacks the new design, and starts new kid measures. 
  • status: Shows the administration status. 

Start, Stop and Restart Apache on Ubuntu and Debian

SystemD is a framework and administration administrator for the most recent Ubuntu (18.04 , 16.04) and Debian (10 , 9 ) discharges. 

Execute the accompanying order to begin the Apache administration: 

sudo systemctl start apache2

Execute the accompanying order to stop the Apache administration: 

sudo systemctl stop apache2

At whatever point you make changes to the Apache setup, you have to restart the worker measures. Execute the accompanying order to restart the Apache administration: 

sudo systemctl restart apache2

More established (EOLed) renditions of Ubuntu or Debian are utilizing init.d contents to begin, stop and restart the Apache daemon: 

sudo service apache2 start 
sudo service apache2 stop
sudo service apache2 restart

Start, Stop and Restart Apache on RHEL/CentOS 

Systemd is the framework and administration administrator for RHEL/CentOS 7 and 8 . 

Start the Apache administration: 

sudo systemctl start httpd

Stop the Apache administration: 

sudo systemctl stop httpd

Restart the Apache administration: 

sudo systemctl restart httpd

In the event that you have CentOS 6 (or prior) utilize the accompanying orders to begin, stop and restart the Apache daemon: 

sudo service httpd start 
sudo service httpd stop
sudo service httpd restart

Conclusion

In this guide, we have told you the best way to begin, stop, and restart the Apache webserver on different Linux frameworks. 

In the event that you have any inquiries or criticism, don't hesitate to remark underneath.




CFG