How To Start, Stop, Restart and Manage Apache Web Server In Linux? – POFTUT

How To Start, Stop, Restart and Manage Apache Web Server In Linux?

Apache or Apache 2 is the most popular web server on the internet. We have set up our Apache server and made some configuration change we want to activate the changes. To active the changes, Apache server must be restart. In this post, we will look at how to restart Apache in different ways in Ubuntu and CentOS.

Start Apache with systemctl Command

Systemctl is a tool for managing Linux services, operating system state, run levels, etc. Systemctl became very popular and currently supported CentOS, Fedora, Ubuntu as default service manager.

Ubuntu, Debian, Mint, Kali:

Start Apache with systemctl Command

Start Apache with systemctl Command

CentOS, Fedora:

If we look status line starts with  Active we can see that Apache2 service is started 5 seconds ago.

Another way perhaps more complicated way to restart Apache2 with systemctl is first stopping the service and then starting it.

Ubuntu, Debian:

Start Apache with systemctl Command

Start Apache with systemctl Command

CentOS, Fedora:

Start and Restart Apache with apachectl Command

An alternative way to restart Apache 2 service is using native tool apachectl . Syntax of apachectl is like below.

We can use restart command with apachectl.

Start and Restart Apache with apachectl Command

Start and Restart Apache with apachectl Command

As we see apachectl provides restart operation logs too.

LEARN MORE  HTTP 403 Forbidden Status Code and Fix Error

Start and Restart Apache with Init.rc Script

Apache provides init.rc related daemon control script under /etc/init.d . This scripts can be used to restart Apache too.

Ubuntu, Debian:

CentOS,Fedora:

We need root privileges too to use this init.rc script. After restart script provides information about restart operation. In this example, it seems everything done without a problem.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)