[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedMarch 7, 2023

How to Start, Stop, or Restart Apache.

How To Start, Stop, Or Restart Apache.

This article explains how to start, stop, and restart Apache on the most popular Linux distributions.

Most of the recent Linux distributions are using SystemD as the default init system and service manager. Older distributions are based on SysVinit and using init scripts to manage services. Another difference is the name of the service. In Ubuntu and Debian, the Apache service is named apache2, while in Red Hat based system such as CentOS, the name of the service is httpd.

 

Before You Begin

The instructions assume that you are logged in as root or user with sudo privileges.

Both SystemD service units and SysVinit 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

SystemD is a system and service manager for the latest Ubuntu (20.04 18.04 ) and Debian (10 , 9 ) releases.

To start the Apache service, execute the following command:

sudo systemctl start apache2

To stop the Apache service, execute the following command:

sudo systemctl stop apache2

Whenever you make changes to the Apache configuration, you need to restart the server processes. To restart the Apache service, run:

sudo systemctl restart apache2

Older (EOLed) versions of Ubuntu or Debian are using init.d scripts to start, stop and restart the Apache daemon:

sudo service apache2 startsudo service apache2 stopsudo service apache2 restart

 

Start, Stop and Restart Apache on RHEL/CentOS

Systemd is the system and service manager for RHEL/CentOS 7 and 8 .

Start the Apache service:

sudo systemctl start httpd

Stop the Apache service:

sudo systemctl stop httpd

Restart the Apache service:

sudo systemctl restart httpd

If you have CentOS 6 or earlier system that uses SysV, use the following commands to start, stop and restart the Apache daemon:

sudo service httpd startsudo service httpd stopsudo service httpd restart

 

Conclusion

We have shown you how to start, stop, and restart the Apache webserver on various Linux systems.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM