• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Start, Stop, or Restart Apache Service

Written by Admin, Updated On August 25, 2020
apache, terminal
How to Start, Stop, or Restart Apache

Apache is cross-platform and open-source Web server. It is part of the popular LAMP (Linux, Apache, MySQL, PHP) stack of software. This guide will show you how to start, stop, and restart Apache service on Linux systems.

It comes loaded with powerful features and can be further extended with a wide variety of modules. The Apache service managing are different across Linux distributions.

Currently, the latest Linux distributions are using SystemD as the default init system and service manager. So based on this Apache service can be manage and also the name of the service are different across the distributions. For example, in Ubuntu and Debian, the Apache service name is apache2 while in Red Hat based system like CentOS, the Apache service name is httpd.

Prerequisite#

Make sure you are logged in as root or user with sudo privileges.

The SystemD service units script takes the following arguments to manage the Apache service:

  • start: Starts the Apache service.
  • stop: Terminates the Apache service.
  • restart: Stops and then starts the Apache service.
  • reload: Gracefully restarts the Apache service. On reload, the main Apache process shuts down the child processes, loads the new configuration, and starts new child processes.
  • status: Shows the service status.

Start, Stop and Restart Apache on Ubuntu and Debian#

On latest Ubuntu 20.04, 18.04, 16.04 and Debian 10, 9 ships with SystemD as system and service manager.

To start the Apache service run the below command:

sudo systemctl start apache2

Execute the following command to stop the Apache service:

sudo systemctl stop apache2

When you do any changes to the Apache configuration, you need to restart the server processes. Run the following command to restart the Apache service:

sudo systemctl restart apache2

Start, Stop and Restart Apache on RHEL/CentOS#

Also, on RHEL/CentOS 7 and 8 Systemd is the system and service manager.

Start the Apache service:

sudo systemctl start httpd

Stop the Apache service:

sudo systemctl stop httpd

Restart the Apache service:

sudo systemctl restart httpd

Conclusion#

In this article, we show you how to start, stop, and restart Apache service on various Linux systems.

If you have any questions or suggestion, please leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install Apache Cassandra on CentOS 8
Next Article   How to Install Slack on Ubuntu 20.04 System

Related Posts

  • How to Use sed to Find and Replace String in Files

    How to Use sed to Find and Replace String in Files

    December 18, 2020
  • Linux Head Command

    Linux Head Command

    December 16, 2020
  • Rename Files and Directories in Linux

    How to Rename Files and Directories in Linux

    December 15, 2020

Leave a Reply Cancel reply

Popular Posts

  • How to Install Microsoft Edge Browser on Ubuntu 20.04 February 14, 2021
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook