April 20, 2024

Start, Restart and Stop Apache web server on Linux

In this article, we are going to show you how you can start, restart and stop the apache server in any Linux environment, just pay your attention and follow the article

In this post, we will use the following commands in order to start, stop and restart the apache server

service command

This method mostly works on CentOS and RedHat Linux Distributions. In centOS and RedHat environment apache server is basically known as httpd server.

Copy code snippet
To Start apache server, run
$ sudo service httpd start

To Stop apache server, run
$ sudo service httpd stop

To re-start apache server, run
$ sudo service httpd restart

To gracefully reload apache server, run:
$ sudo service httpd reload

Service command for Debian and Ubuntu Linux Distributions

To Start apache2 server, run
$ sudo service apache2 start

To Stop apache server, run
$ sudo service apache2 stop

To re-start apache2 server, run
$ sudo service apache2 restart

To gracefully reload apache2 server, run:
$ sudo service apache2 reload

systemctl command 

We use systemctl to start Apache 2 on Ubuntu Linux LTS 16.04 LTS or the latest system based Ubuntu Linux. 

To Start apache server, run
$ sudo systemctl start apache2.service

To Stop apache server, run
$ sudo systemctl stop apache2.service

To re-start apache server, run
$ sudo systemctl restart apache2.service

To check the status, run:
$ sudo systemctl status apache2.service

apache2ctl command 

apache2ctl command can be used to stop or start the apache web server under any Linux distribution or UNIX.

To Start apache server, run
$ sudo apache2ctl start

To Stop apache server, run
$ sudo apache2ctl stop

To re-start apache server, run
$ sudo apache2ctl restart

To gracefully reload apache server, run
$ sudo apache2ctl graceful

For Ubuntu Linux LTS 12. 04 and 14.04 Distribution

To start Apache 2 on Ubuntu 14.04, run
$ sudo start apache2

To stop Apache 2 onUbuntu 14.04, run
$ sudo stop apache2

To restart Apache 2 onUbuntu 14.04, run 
$ sudo restart apache2

To gracefully reload Apache 2 onUbuntu 14.04, run
$ sudo restart apache2

Vedant Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh