How to Start, Stop and Restart Apache Server

How to Start, Stop and Restart Apache Server
How to Start, Stop and Restart Apache Server

Start, Stop and Restart Apache Server

Apache is one of the most popular and most used HTTP web servers in the world. Apache Webserver is the free, opensource, powerful, stable, cross-platform, reliable web server. It also provides features that can be extended by the wide variety of modules. Apache can also be used as a reverse proxy server in different scenarios. In this tutorial, you are going to learn how to Start, Stop and Restart Apache Server.

Prerequisites

Before you begin must have the non-root user account on your system with sudo privileges.

Start, Stop and Restart Apache on Debian or Ubuntu

For Ubuntu 18.04, 16.04 and Debian 10, 9 Versions

The following commands are useful on Ubuntu 18.04, 16.04 and Debian 10, 9 because it uses SystemD service manager.

To Start Apache Webserver you can execute the following command in the terminal:

sudo systemctl start apache2

Now to Stop Apache Webserver you can execute the following command in the terminal:

sudo systemctl stop apache2

Here to Restart Apache Webserver you can execute the following command in the terminal:

sudo systemctl restart apache2

To Reload Apache Webserver configuration file and restart it, you can execute the following command in the terminal:

sudo systemctl reload apache2

For older Ubuntu and Debian Versions

To Start Apache Webserver you can execute the following command in the terminal:

sudo service apache2 start

Here to Stop Apache Webserver you can execute the following command in the terminal:

sudo service apache2 stop

Now Restart Apache Webserver you can execute the following command in the terminal:

sudo service apache2 restart

To Reload Apache Webserver configuration file and restart it, you can execute the following command in the terminal:

sudo service apache2 reload

Start, Stop and Restart Apache on RHEL and CentOS

For RHEL 8, 7 and CentOS 8, 7 Versions

The following commands are useful on RHEL 8, 7 and CentOS 8, 7 because it uses the SystemD service manager.

To Start Apache Webserver you can execute the following command in the terminal:

sudo systemctl start httpd

Next Stop Apache Webserver you can execute the following command in the terminal:

sudo systemctl stop httpd

Now to Restart Apache Webserver you can execute the following command in the terminal:

sudo systemctl restart httpd

To Reload Apache Webserver configuration file and restart it, you can execute the following command in the terminal:

sudo systemctl reload httpd

For older RHEL and CentOS Versions

To Start Apache Webserver you can execute the following command in the terminal:

sudo service httpd start

Now to Stop Apache Webserver you can execute the following command in the terminal:

sudo service httpd stop

Next to Restart Apache Webserver you can execute the following command in the terminal:

sudo service httpd restart

To Reload Apache Webserver configuration file and restart it, you can execute the following command in the terminal:

sudo service httpd reload

Conclusion

You have successfully learned how to install How to Start, Stop and Restart Apache Server. If you have any queries regarding this then please don’t forget to comment below.

LEAVE A REPLY

Please enter your comment!
Please enter your name here