nginx(Permission denied)问题debug&解决

 

关键词 DEBUG ,NGINX ,Permission denied

[问题] 页面访问所需资源访问失败。访问日志记录显示成功,错误日志报错: Permission denied
如下:
access.log
【xxx.xxx.xxx.xxx】 - - [15/Mar/2023:13:14:36 +0800] "GET /static/css/2.068df95f.chunk.css HTTP/1.1" 200 113939 "https://[host_name]/home/video?token=new1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"
【xxx.xxx.xxx.xxx】 - - [15/Mar/2023:13:14:36 +0800] "GET /static/js/main.549e6a20.chunk.js HTTP/1.1" 200 163425 "https://[host_name]/home/video?token=new1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"
【xxx.xxx.xxx.xxx】 - - [15/Mar/2023:13:14:36 +0800] "GET /static/css/main.dd3810f3.chunk.css HTTP/1.1" 200 97903 "https://[host_name]/home/video? 

---------error.log--------------
2023/03/15 13:14:36 [crit] 17906#17906: *1 open() "/var/cache/nginx/proxy_temp/1/00/0000000001" failed (13: Permission denied) while reading upstream, client: 【xxx.xxx.xxx.xxx】, server: 10.78.170.53, request: "GET /static/js/main.549e6a20.chunk.js HTTP/1.1", upstream: "http://127.0.0.1:3001/static/js/main.549e6a20.chunk.js", host: "[host_name]", referrer: "https://[host_name]/home/video?token=new1"
2023/03/15 13:14:36 [crit] 17906#17906: *4 open() "/var/cache/nginx/proxy_temp/2/00/0000000002" failed (13: Permission denied) while reading upstream, client:  

【解决方法】

查看nginx进程ps aux|grep nginx
发现都是nobody的进程,但是nginx的目录都是root用户, 而且root启动。
查看nginx.conf:
user nobody
改成:user root
注意:只是注释掉(#user nobody),没重新赋值默认还是nobody

停止nginx -s stop
重启nginx -c nginx.conf

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值