How to Start, Stop, or Restart Apache Server on Ubuntu

February 29, 2024


Apache is part of the popular LAMP (Linux, Apache, MySQL, PHP) software stack. The Apache server is the basis of many web hosting stacks, including business websites, SaaS products, and multiple AI-powered applications.

Apache's popularity comes from its seamless integration and reliable high performance under increasing workloads. Knowing how to start, stop, and restart Apache in Ubuntu and similar distributions is crucial for efficient server management.

In this tutorial, you will learn how to start, stop, and restart Apache in Ubuntu.

How to start, stop, or restart the Apache server in Ubuntu - a tutorial.


How to Start Apache on Ubuntu

There are several ways to start the Apache web server on Ubuntu, depending on whether you have a systemd-based system or a SysVinit-based system.

A systemd-based system uses systemd as its init system, which provides service management capabilities and parallelization. On the other hand, a SysVinit-based system relies on the traditional System V init system, which is simpler and less feature-rich.

Follow the steps below to start Apache:

1. Open the terminal and run one of the following commands, depending on your system type:

Systemd-based systems:

sudo systemctl start apache2

This command is the modern and preferred way to manage services on systemd-based Linux distributions. systemctl communicates directly with systemd to start, stop, enable, or disable services.

SysVinit-based systems:

sudo /etc/init.d/apache2 start

The command above directly executes the Apache2 init script, which is used in traditional SysVinit systems. While this method is still supported in many Linux distributions for backward compatibility, it is considered outdated compared to systemctl.

All system types:

sudo service apache2 start

The above command is a system-independent way to start the Apache2 service that works across various Linux distributions and init systems. The command checks whether the system uses systemd or SysVinit and then calls the appropriate command (systemctl for systemd-based systems and the init script for SysVinit-based systems).

2. Verify that the service has successfully started by checking its status. Run one of the following commands:

Systemd-based systems:

sudo systemctl status apache2

SysVinit-based systems:

sudo /etc/init.d/apache2 status

All system types:

sudo service apache2 status

The output should provide the service status details and state that the service is active:

Checking the Apache service status after starting it.

Note: After installing Apache and starting the service, see how to set up Apache virtual hosts.

3. To make sure Apache starts on system startup, run one of the commands below:

Systemd-based systems:

sudo systemctl enable apache2

SysVinit-based systems:

sudo /etc/init.d/apache2 enable

All system types:

sudo service apache2 enable
Enabling Apache on system startup.

Note: Learn how to check Apache version via CLI, WHM or cPanel.

How to Restart Apache on Ubuntu

Restarting the Apache service initiates a force restart. A force restart (or hard restart) abruptly stops and then starts Apache, which can interrupt active connections. It is a more aggressive action and may cause some users to experience temporary disruptions in service.

To restart the Apache server, open the terminal and run one of the commands below:

Systemd-based systems:

sudo systemctl restart apache2

SysVinit-based systems:

sudo /etc/init.d/apache2 restart

All system types:

sudo service apache2 restart

Note: The restart command can take a few moments to complete, depending on the complexity of your server configuration. If you are running a large or complex server configuration, this can cause disruptions for users who rely on the server.

How to Stop Apache on Ubuntu

Stopping the Apache service halts the Apache server, terminates any active connections, and shuts down all associated processes. This action suspends the serving of web pages or applications hosted by Apache until the service is started again.

To stop Apache on Ubuntu, open the terminal and run one of the following commands:

Systemd-based systems:

sudo systemctl stop apache2

SysVinit-based systems:

sudo /etc/init.d/apache2 stop

All system types:

sudo service apache2 stop

To confirm that Apache has been stopped, check the service's status:

Checking Apache status after stopping the service in Ubuntu.

If the service is no longer running, the output indicates an inactive (dead) status message, as in the screenshot above.

How to Reload Apache on Ubuntu

Reloading Apache means gracefully restarting it, as opposed to a force (hard) restart.

A graceful restart means that Apache will attempt to restart without interrupting any active connections. It finishes serving any current requests, reloads the configuration, and restarts any necessary processes. Reloading is a smoother process that minimizes downtime.

To reload the Apache server, open the terminal and run one of the commands below:

Systemd-based systems:

sudo systemctl reload apache2

SysVinit-based systems:

sudo /etc/init.d/apache2 reload

All system types:

sudo service apache2 reload

After reloading, check the service status to ensure it is running.


This tutorial showed how to start, stop, and restart the Apache service on Ubuntu. Knowing how to do these basic tasks is essential when managing a server, and the commands listed in this guide make the task fast and easy.

Next, see how to view, configure, and use Apache log files or learn the difference between Apache and Nginx.

Was this article helpful?
Goran Jevtic
Goran combines his leadership skills and passion for research, writing, and technology as a Technical Writing Team Lead at phoenixNAP. Working with multiple departments and on various projects, he has developed an extraordinary understanding of cloud and virtualization technology trends and best practices.
Next you should read
How To Install the Apache Web Server on Ubuntu
February 20, 2024

This guide will help you install the Apache web server on an Ubuntu operating system.
Read more
How To Start, Stop, Or Restart Apache Server On CentOS 7
January 23, 2019

In this SIMPLE Updated Tutorial Learn How to restart, start, & stop Apache web server on the CentOS 7 Linux operating system. Find out how now!
Read more
How To Set Up & Configure ModSecurity On Apache
March 11, 2019

ModSecurity is an Open-source firewall application for Apache. Learn how to Setup & Configure ModSecurity on Apache (Debian, Ubuntu, CentOS).
Read more
How To Install MySQL 8.0 In Ubuntu 18.04
December 12, 2018

MySQL is an open-source relational database server tool for Linux operating systems. It is widely used...
Read more