e Learning

How to Restart Apache on CentOS 7

In this tutorial we are going to learn how to restart the Apache server on CentOS 7 Linux operating system.

Two Commands can be used to Restart Apache HTTPD Server on CentOS 7 Linux. Those Two Commands are systemctl command and apachectl command. You Can use either of the Two commands to Restart Apache on CentOS 7.

Restart Apache Server Using Systemctl Command

The systemctl command use to start, stop and restart services in CentOS 7. To Restart Apache httpd server type,

systemctl restart httpd

restart apache centos 7

We can use the reload option to just reload the httpd.conf file instead of restarting the entire httpd process.

systemctl reload httpd

After you made changes to your CentOS Apache configuration file, you can use the reload option to reload the httpd.conf file without closing currently open http connections.

Restart HTTPD Server Using Apachectl Command

The apachectl command is a front tool uses to manage Apache HTTPD Server on Linux. To Restart Apache on CentOS 7 execute,

apachectl restart

Just like systemctl command, apachectl also have a command option called graceful, which reloads the httpd.conf file instead of restarting HTTPD service on CentOS 7.

apachectl graceful

If You are Using CentOS 6.5 or Older version, You can use the service command to Restart Apache HTTPD Server.

service httpd restart

Service command still can be to use in CentOs7, but it will redirect to systemctl Command.