解决open()failed (13: Permission denied) while reading upstream的问题

解决open()failed (13: Permission denied) while reading upstream的问题

前言

    为了提高Nginx的处理能力,我们会配置Nginx配置文件使Nginx启动多个work进程。例如:
    #user root root;
    worker_processes     8;
    worker_cpu_affinity auto;
    #error_log  /dev/null;
    daemon on;
    master_process on;

    启动Nginx后,Nginx的进程信息如下:
    [root@www tengine]# ps -ef |grep nginx
    root      58905      1  0 10:04 ?        00:00:00 nginx: master process ./sbin/nginx
    nobody    58906  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58907  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58908  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58909  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58910  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58911  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58912  58905  0 10:04 ?        00:00:00 nginx: worker process
    nobody    58913  58905  0 10:04 ?        00:00:00 nginx: worker process
    root      58915   3344  0 10:04 pts/0    00:00:00 grep --color=auto nginx


出现问题

    网站页面出现异常,部分信息加载不出来。

浏览器报错


    jquery-2.2.3.min.js:4 GET http://192.168.74.84/v1/pkis/ServerCertRequestList     net::ERR_INCOMPLETE_CHUNKED_ENCODING
    send @ jquery-2.2.3.min.js:4

查看Nginx的error.log

    日志信息如下:
    2017/11/28 16:32:43 [crit] 5100#0: *768 open() "/tengine/fastcgi_temp/4/03/0000000034"     failed (13: Permission denied) while reading upstream, client: 192.168.74.236, server: ,     request: "GET /v1/pkis/ServerCertRequestList HTTP/1.1", upstream:     "fastcgi://127.0.0.1:9000", host: "192.168.74.84"


分析问题及解决方法

分析问题

    出错原因是work进程没有打开/tengine/fastcgi_temp/4/03/0000000034 文件的权限。work进程属于nobody用户组,nobody用户名。因此只要把fastcgi_temp 目录权限赋给nobody用户组,nobody用户名就可以了。

解决问题

 [root@www tengine]# ps aux | grep "nginx: worker process" | awk '{print $1}'
 nobody
 root
 [root@www tengine]# chown -R nobody:nobody fastcgi_temp/


  • 5
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值