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 snippetTo 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