socket() failed (13: Permission denied) while connecting to upstream

/***************************************************************************
 *  socket() failed (13: Permission denied) while connecting to upstream
 * 说明:
 *     这个错误隐藏的挺深的,观察了许久,才从ps aux中的执行用户中找出来。
 *
 *                                         2016-9-26 深圳 南山平山村 曾剑锋
 **************************************************************************/

一、错误现象:
    2000/01/01 00:45:23 [alert] 1458#0: *1 socket() failed (13: Permission denied) while connecting to upstream, client: 192.168.1.144, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "192.168.1.203"

二、原因:
    1. # ps aux
        ......
        1407 root     /sbin/klogd -n
        1460 root     udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0
        1466 root     nginx: master process /usr/sbin/nginx
        1468 www-data nginx: worker process
        1474 root     /usr/sbin/sshd
        1481 root     /usr/sbin/telnetd -F
        1485 root     php-cgi -b 127.0.0.1:9000 -c /etc/php.ini
        1494 root     {mysqld_safe} /bin/sh /usr/bin/mysqld_safe --pid-file=/run/mysql
        1631 root     /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=r
        1634 root     -sh
        1638 root     ps
    2. 如上所示,1468进程执行用户是www-data无法访问到1485进程的php-cgi,因为这个root权限。

三、解决办法:
    cat /etc/nginx/nginx.conf
        user  root;
        ......

 

posted on 2016-09-26 19:16  zengjf  阅读(1405)  评论(0编辑  收藏  举报

导航