Apache is one of the most widely used web servers. It is free, open-source software developed and maintained by Apache software foundation. It offers fast performance, reliability, security and customization options with the help of numerous extensions and modules. It is valued Apache powers about 67% of all websites in the world.
This guide shows how to restart the Apache HTTPD service on Ubuntu 22.04.
To perform the steps shown in this guide, you need the following components:
- A properly configured Ubuntu 22.04 system
- The latest version of the Apache Web server installed and configured. Check the installation Apache on Ubuntu 22.04
- Access for a non-root user with sudo permit
That Apache HTTPD service
Ubuntu used systemd, a popular init system and service manager for Linux. It has various features such as B. Snapshot support, process tracking and daemon management. In addition to Ubuntu, most modern Linux distributions are included systemd preinstalled.
At the installation Apache registers a dedicated service, apache2.servicewith a systemd for easier management. This allows us to manage them Apache Service with tools like systemctl and service.
There are several scenarios where you can consider a reboot Apache:
- When changing mission-critical Apache Construction
- The server is behaving strangely
reboot Apache HTTPD using systemctl
Use systemctl is the recommended way to manage services that are used systemd. The command structure is as follows:
Reboot after the structure Apache with the following command:
reboot Apache HTTPD Usage Service
That service command is another tool that can manage system services. However, the service command structure is slightly different from the systemctl. In addition, its functionality is also limited to basic service management.
The command structure is as follows:
After this structure, use the following command to reboot Apache:
examination Apache status
The status of the service helps debug abnormal behavior. To check the Apache Service status use one of the following commands:
If you want to shut down manually Apache server, and then run one of the following commands:
If you only changed those Apache configuration file(s), we can simply reload the service instead of a full restart, which saves time and energy. The reload command Apache is as follows:
If a service is enabled, systemd starts the service automatically at boot. If not, you need to manually enable the service. If you disable a service, the systemd will no longer start it at boot time.
Begin Apache On boot use the following command:
To disable the Apache use this command:
In this guide, we have successfully demonstrated the reboot Apache HTTPD on Ubuntu using systemctl and service Tool. We also reload, enable and disable the Apache Service.
The systemctl tool can do a lot more. For example checkout List of all services registered with systemd.
Frequently, Apache is installed as 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 work with it too virtual hostsserving multiple computers.