Ubuntu CentOS Restart Apache Web Server

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/ubuntu-centos-restart-apache-web-server-apache2/
PINTEREST
PINTEREST
INSTAGRAM

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

Using Systemctl

Systemctl is 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:

CentOS, Fedora:

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

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

Ubuntu, Debian:

CentOS, Fedora:

Apachectl

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

As we see apachectl provides restart operation logs too.

Init.rc

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:

LEARN MORE  How To List MySQL / MariaDB Database

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 problem.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/ubuntu-centos-restart-apache-web-server-apache2/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)