1、优雅停止

信号:WINCH

[root@localhost~]# /appl/apache/bin/apachectl  -kgraceful-stop  #
[root@localhost ~]# elinks -dump http://192.168.137.3 #使用elinks访问测试
ELinks: 拒绝连接

LAMP系列之Apache优雅重启、优雅关闭_第1张图片

2、优雅重启

信号:USR1
 [root@localhost ~]# /appl/apache/bin/apachectl -k graceful
httpd not running, trying to start
[root@localhost ~]# ps aux |grep httpd
root      5595  0.0  0.3  33420  3260 ?        Ss   16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
daemon    5596  0.0  0.1  31976  1296 ?        S    16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
daemon    5597  0.0  0.1  33152  1144 ?        S    16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
daemon    5598  0.0  0.3 377680  3900 ?        Sl   16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
daemon    5599  0.0  0.3 377680  3904 ?        Sl   16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
daemon    5600  0.0  0.3 377680  3908 ?        Sl   16:34   0:00 /appl/apache2.2.22/bin/httpd -k graceful
root      5683  0.0  0.0 103248   836 pts/1    S+   16:34   0:00 grep httpd
测试:
[root@localhost ~]# elinks -dump http://192.168.137.3
                                   It works!

LAMP系列之Apache优雅重启、优雅关闭_第2张图片

3Apache正常启动、关闭、重启

[root@localhost ~]# /appl/apache/bin/apachectl -k stop
httpd (no pid file) not running
[root@localhost ~]# elinks -dump http://192.168.137.3
ELinks: 拒绝连接
[root@localhost ~]#
[root@localhost ~]# /appl/apache/bin/apachectl -k start
[root@localhost ~]# elinks -dump http://192.168.137.3 
                                   It works!
[root@localhost ~]# /appl/apache/bin/apachectl -k restart
[root@localhost ~]# elinks -dump http://192.168.137.3   
                                   It works!