How to Start, Stop and Restart Apache by using the SSH Command?



Apache is a Web server and used to serve the content for the static as well for the dynamic web pages on the World Wide Web, and it is very necessary to restart the Apache when you have made any changes into the php.ini file, The syntax is very easy but it is different according to the Operating system which is installed on the Server. Here in this post I am trying to describe how we can Start, Stop and Restart Apache by using the SSH Command.

Apache is a Web server and used to serve the content for the static as well for the dynamic web pages on the World Wide Web, and it is very necessary to restart the Apache when you have made any changes into the php.ini file, The syntax is very easy but it is different according to the Operating system which is installed on the Server. Here in this post I am trying to describe how we can Start, Stop and Restart Apache by using the SSH Command.

First of all you should login to the web server by using the SSH, and I assumes that you have the root access of your server and you can connect to the server by using your credentials:

1. Start, Stop and Restart Apache by using the SSH Command on Debian/Ubuntu:

a. Starting the Apache 
/etc/init.d/apache2 start
b. Stopping the Apache 
/etc/init.d/apache2 stop
c. Restarting the Apache 
/etc/init.d/apache2 restart
d. Reloading the Apache
/etc/init.d/apache2 reload
e. Restarting the Apache Gracefully
/etc/init.d/apache2 restart-graceful

OR

a. Starting the Apache 
sudo service apache2 start
b. Stopping the Apache 
sudo service apache2 stop
c. Restarting the Apache 
sudo service apache2 restart
d. Reloading the Apache
sudo service apache2 reload
e. Restarting the Apache Gracefully
sudo service apache2 restart-graceful

2. Start, Stop and Restart Apache by using the SSH Command on CentOS/Fedora Linux version 4.x/5.x/6.x or older:

a. Starting the Apache 
service httpd start
b. Stopping the Apache 
service httpd stop
c. Restarting the Apache 
service httpd restart
d. Reloading the Apache
service httpd reload
e. Restarting the Apache Gracefully
service httpd restart-graceful

OR

a. Starting the Apache 
apachectl start
b. Stopping the Apache 
apachectl stop
c. Restarting the Apache 
apachectl restart
d. Reloading the Apache
apachectl reload
e. Restarting the Apache Gracefully
apachectl restart-graceful

OR

a. Starting the Apache 
/sbin/service httpd start
b. Stopping the Apache 
/sbin/service httpd stop
c. Restarting the Apache 
/sbin/service httpd restart
d. Reloading the Apache
/sbin/service httpd reload
e. Restarting the Apache Gracefully
/sbin/service httpd restart-graceful

Hope it helps and you enjoyed reading, if you need the professional Magento Development we can help you, just Click on the Link and send me your requirements.

Please Like the Post on Facebook or Google+.