nginx重启时遇到open() "/usr/local/nginx/sbin/ngnix.pid" failed

今天安装配置完nginx时,重启时遇到如下问题

[root@hwtest-hk sbin]# ./nginx -s stop
nginx: [error] open() "/usr/local/nginx/sbin/ngnix.pid" failed (2: No such file or directory)
解决上面的办法是重新加载一下ngnix的配置命令如下
[root@hwtest-hk sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

结果遇到了上述提示的80端口被占用问题

[root@hwtest-hk sbin]#  sudo fuser -k 80/tcp
80/tcp:               7521  7522  7523  7524  7525  7526  7527  7528  7529  7530  7531  7532  7533  7534  7535  7536  7537

并重新再次加载nginx配置文件

[root@hwtest-hk sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
再次校验nginx

[root@hwtest-hk sbin]# ./nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@yolotone-hk sbin]# ./nginx 
启动完成,done!



猜你喜欢

转载自blog.csdn.net/hwhanwan/article/details/53219886