[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
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 use who command.
August 14, 2023

How to use who command.

How To Use Who Command. In this article, we explain the who command that is bundled in GNU coreutils package. who is a command-line utility that prints a list of currently logged in users. It can also show the current run level, time of the last system boot, and more. How to Use the…

Read article
How to use basename command.
August 14, 2023

How to use basename command.

How To Use Basename Command. basename is a command-line utility that strips directory and trailing suffix from given file names. Using the basename Command The basename command supports two syntax formats: basename NAME [SUFFIX] basename OPTION… NAME… basename takes a filename and prints the last…

Read article
How to use chattr command in Linux.
August 14, 2023

How to use chattr command in Linux.

How To Use Chattr Command In Linux. This article explains how to use the chattr command to change file attributes on Linux file systems. In Linux, file attributes are meta-data properties that describe the file’s behavior. For example, an attribute can indicate whether a file is compressed or…

Read article
Get in Touch

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

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

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00