How to start/stop/restart httpd Apache service on CentOS 7 / RHEL 7 Server

How to restart httpd Apache service on CentOS 7 / RHEL 7 Server

 

Do the below to restart apache service on centOS 7 / RHEL 7 Server.

1. Command to restart apache on centOS 7 / RHEL 7 Server : service httpd restart
 

root@server [/]# service httpd restart
Redirecting to /bin/systemctl restart httpd.service
root@server [/]#

 
2. Command to restart apache on centOS 7 / RHEL 7 Server : systemctl restart httpd.service
 

root@server [/]# systemctl restart httpd.service
root@server [/]#

 
How to check status of Apache process on the Server

Command to check status of Apache process : systemctl status httpd.service
 

root@server [/]# systemctl status httpd.service
* httpd.service – Apache webserver managed by cPanel EasyApache
Loaded: loaded (/etc/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2016-07-09 10:01:03 EDT; 1min 35s ago
Process: 2298 ExecStart=/usr/local/cpanel/scripts/restartsrv_httpd –no-verbose (code=exited, status=0/SUCCESS)
Main PID: 2308 (httpd)
CGroup: /system.slice/httpd.service
|-2308 /usr/local/apache/bin/httpd -k start
|-2309 /usr/local/cpanel/3rdparty/bin/perl /usr/local/cpanel/bin/leechprotect
|-2310 /usr/local/apache/bin/httpd -k start
|-2311 /usr/local/apache/bin/httpd -k start
|-2312 /usr/local/apache/bin/httpd -k start
|-2313 /usr/local/apache/bin/httpd -k start
|-2314 /usr/local/apache/bin/httpd -k start
`-2319 /usr/local/apache/bin/httpd -k start

Jul 09 10:01:02 server systemd[1]: Starting Apache webserver managed by cPanel EasyApache…
Jul 09 10:01:02 server restartsrv_httpd[2298]: AH00548: NameVirtualHost has no effect and will be removed in the next release /usr/local/apache/conf/httpd.conf:311
Jul 09 10:01:03 server systemd[1]: Started Apache webserver managed by cPanel EasyApache.

 
Apache service is running fine on the above server.