How to start, stop and restart Apache server

Start, stop, restart Apache server

Apache is one of the most popular and most used HTTP web servers in the world. Apache Webserver is a free, open source, powerful, stable, cross-platform, reliable web server. It also provides functions that can be extended with various modules. Apache can also be used as a reverse proxy server in various scenarios. In this tutorial, you learn how to start, stop, and restart the Apache server.

Prerequisites

Before you begin, your system must have a non-root user account 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 they use the SystemD Service Manager.

To Start Apache Webserver allows you to run the following command in a terminal:

sudo systemctl start apache2

Now Stop Apache Webserver allows you to run the following command in a terminal:

sudo systemctl stop apache2

here Restart Apache Webserver allows you to run the following command in a terminal:

sudo systemctl restart apache2

To Reload After restarting the Apache Webserver configuration file, you can run the following command in Terminal:

sudo systemctl reload apache2

For older Ubuntu and Debian versions

To Start Apache Webserver allows you to run the following command in a terminal:

sudo service apache2 start

here Stop Apache Webserver allows you to run the following command in a terminal:

sudo service apache2 stop

now Restart Apache Webserver allows you to run the following command in a terminal:

sudo service apache2 restart

To Reload After restarting the Apache Webserver configuration file, you can run the following command in 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 for RHEL 8, 7 and CentOS 8, 7 because they use the SystemD Service Manager.

To Start Apache Webserver allows you to run the following command in a terminal:

sudo systemctl start httpd

Next Stop Apache Webserver allows you to run the following command in a terminal:

sudo systemctl stop httpd

Now Restart Apache Webserver allows you to run the following command in a terminal:

sudo systemctl restart httpd

To Reload After restarting the Apache Webserver configuration file, you can run the following command in Terminal:

sudo systemctl reload httpd

For older RHEL and CentOS versions

To Start Apache Webserver allows you to run the following command in a terminal:

sudo service httpd start

Now Stop Apache Webserver allows you to run the following command in a terminal:

sudo service httpd stop

next to Restart Apache Webserver allows you to run the following command in a terminal:

sudo service httpd restart

To Reload After restarting the Apache Webserver configuration file, you can run the following command in Terminal:

sudo service httpd reload

Conclusion

You learned how to install Apache server start, stop and restart methods. If you have any questions about this, don’t forget to comment below.

Sidebar