How to reboot Apache HTTPD on Ubuntu 22.04

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.

requirements

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:

$ sudo systemctl <action> <service name>

Reboot after the structure Apache with the following command:

$ sudo systemctl restarts apache2.service

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:

$ sudo service <service name> <action>

After this structure, use the following command to reboot Apache:

$ sudo Restart Apache2 service

Additional tips

examination Apache status

The status of the service helps debug abnormal behavior. To check the Apache Service status use one of the following commands:

$ sudo systemctl status apache2.service

$ sudo Service apache2 status

Stop Apache

If you want to shut down manually Apache server, and then run one of the following commands:

$ sudo systemctl stops apache2.service

$ sudo Stop apache2 service

Reload Apache

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:

$ sudo systemctl reloads apache2.service

$ sudo Reload service Apache2

Enable/Disable Apache

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:

$ sudo systemctl enable apache2.service

To disable the Apache use this command:

$ sudo systemctl disables apache2.service

Conclusion

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.

Related Posts