nginxサービスを正常に再起動し、エラーを見つけます。
[root@web01 conf]# /application/nginx/sbin/nginx -s reload
nginx: [error] open() "/application/nginx-1.6.3//logs/nginx.pid" failed (2: No such file or directory)
经过查看nginx服务未启动导致的,-s reload平滑优雅重启必须在nginx服务启动的状态才可以重启,就好像电脑还没有开机,你根本找不到重启的按钮。重启是建立在已经启动的状态的。
判断nginx服务器是否启动?
1次の図に示すように、nginxサービスに対応するプロセスがあるかどうかを確認して、nginxサービスに対応するプロセスを表示します。
[root @ web01 conf] #ps -ef | grep nginx
root 1437 1313 0 10:36 pts/1 00:00:00 grep nginx
2nginxサービスに対応するポートに監視があるかどうかに応じて
[root @ web01 conf] #lsof -i:80
[root @ web01 conf]#
[root @ web01 conf] #netstat -lntup | grep nginx
[root @ web01 conf]#
[root @ web01 conf] #netstat -lntup | grep 80
[root @ web01 conf]#
nginxサービスの開始後に確認してください:
[root @ web01 conf]#/ application / nginx / sbin / nginxnginx
プロセスが存在するかどうかを確認します。
[root @ web01 conf] #ps -ef | grep nginx
root 1444 1 0 10:40 ? 00:00:00 nginx: master process /application/nginx/sbin/nginx
www 1445 1444 0 10:40 ? 00:00:00 nginx: worker process
root 1456 1313 0 10:40 pts/1 00:00:00 grep nginx
[root @ web01 conf]#
ポートが存在するかどうかを確認します:
[root @ web01 conf] #lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 1444 root 6u IPv4 12531 0t0 TCP *:http (LISTEN)
nginx 1445 www 6u IPv4 12531 0t0 TCP *:http (LISTEN)
[root @ web01 conf] #netstat -lntup | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1444/nginx
tcp 0 0 0.0.0.0:81 0.0.0.0:* LISTEN 1444/nginx
tcp 0 0 0.0.0.0:82 0.0.0.0:* LISTEN 1444/nginx
[root @ web01 conf] #netstat -lntup | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1444/nginx
[root @ web01 conf] #netstat -lntup | grep 81
tcp 0 0 0.0.0.0:81 0.0.0.0:*
LISTEN 1444 / nginx
[root @ web01 conf] #netstat -lntup | grep 82
tcp 0 0 0.0.0.0:82 0.0.0.0:* LISTEN 1444/nginx
現在、nginxサービスを開始することが決定されているため、正常な再起動を続行してもエラーは報告されません。
[root @ web01 conf]#/ application / nginx / sbin / nginx -s reload
[root @ web01 conf]#