Apache is one of the most widely deployed web servers. It’s free and open-source software developed and maintained by Apache Software Foundation. It offers fast performance, reliability, security, and customization with the help of numerous extensions and modules. It is estimated Apache powers about 67% of all the websites in the world.
This guide will showcase restarting the Apache HTTPD service on Ubuntu 22.04.
To perform the steps demonstrated in this guide, you will need the following components:
Ubuntu utilizes systemd, a popular init system and service manager for Linux. It has various features, such as snapshot support, process tracking, and daemon management. Besides Ubuntu, most modern Linux distros come with systemd pre-installed.
Upon installation, Apache registers a dedicated service, apache2.service, with a systemd for easier management. This allows us to manage the Apache service with tools like systemctl and service.
There are multiple scenarios where you may consider restarting Apache:
Using systemctl is the recommended method of managing any service that uses systemd. The command structure is as follows:
Following the structure, restart Apache using the following command:
The service command is another tool that can manage the system services. However, the service command structure is slightly different than the systemctl. Moreover, its functionality is also limited to basic service management.
The command structure is as follows:
Following this structure, use the following command to restart Apache:
The status of the service helps debug any abnormal behavior. To check the Apache service status, use any of the following commands:
If you want to manually shut down the Apache server, then run any of the following commands:
If you only modified the Apache configuration file(s), we can simply reload the service instead of a full-blown restart, saving time and energy. The command to reload Apache is as follows:
If a service is enabled, then the systemd will start the service automatically upon booting. If not, then you have to activate the service manually. Similarly, if you disable a service, the systemd will no longer start it upon boot.
To start Apache on boot, use the following command:
To disable the Apache service, use this command:
In this guide, we successfully demonstrated restarting the Apache HTTPD on Ubuntu with the help of systemctl and service tools. We also showcased reloading, enabling, and disabling the Apache service.
The systemctl tool can accomplish a lot more. For example, check out listing all the services registered with systemd.
Often, Apache is installed as a part of the LAMP stack to provide a full-fledged web development environment. Learn more about setting up the LAMP stack on Ubuntu. Apache can also work with virtual hosts, serving multiple computing.
The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…
Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…
Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…
Focal Fossa will reach the End of Standard Support in May 2025, also known as…
Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…
Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…