nginx_pid问题

问题

访问测试环境一直报错 NS_ERROR_CONNECTION_REFUSED
在这里插入图片描述

现象

使用ps查看,只能看到一条nginx进程

[root@iZwz918g1z0sb8tcwfjri3Z sbin]# ps -ef|grep nginx
root      6772  4449  0 12:12 pts/1    00:00:00 grep --color=auto nginx

使用 ./nginx -s reload 重新加载配置文件,注意此处invalid PID number,目录 /usr/local/nginx/logs 中 PID文件大小为0k

[srm-test@iZwz918g1z0sb8tcwfjri3Z ~]$ cd /usr/local/nginx/sbin
[srm-test@iZwz918g1z0sb8tcwfjri3Z sbin]$ ./nginx -s reload
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
2023/06/15 14:16:21 [notice] 14734#0: signal process started
2023/06/15 14:16:21 [error] 14734#0: invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"

解决

[root@iZwz918g1z0sb8tcwfjri3Z usr]# cd local/nginx
[root@iZwz918g1z0sb8tcwfjri3Z nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@iZwz918g1z0sb8tcwfjri3Z nginx]# cd sbin/
[root@iZwz918g1z0sb8tcwfjri3Z sbin]# ll
total 6036
-rw-r--r-- 1 root root       2 Jun 15 12:09 access.log
-rwxr-xr-x 1 root root   16930 Mar 16  2020 dso_tool
-rwxr-xr-x 1 root root 6153752 Mar 16  2020 nginx

注意此处,下面这种情况才算是重启成功

[root@iZwz918g1z0sb8tcwfjri3Z 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@iZwz918g1z0sb8tcwfjri3Z sbin]# ps -ef | grep nginx
root     15536     1  0 14:28 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody   15620 15536  0 14:30 ?        00:00:00 nginx: worker process
root     15638 15006  0 14:30 pts/1    00:00:00 grep --color=auto nginx

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值