/***************************************************************************
* socket() failed (13: Permission denied) while connecting to upstream
* 说明:
* 这个错误隐藏的挺深的,观察了许久,才从ps aux中的执行用户中找出来。
*
* 2016-9-26 深圳 南山平山村 曾剑锋
**************************************************************************/ 一、错误现象:
// :: [alert] #: * socket() failed (: 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" 二、原因:
. # ps aux
......
root /sbin/klogd -n
root udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0
root nginx: master process /usr/sbin/nginx
www-data nginx: worker process
root /usr/sbin/sshd
root /usr/sbin/telnetd -F
root php-cgi -b 127.0.0.1: -c /etc/php.ini
root {mysqld_safe} /bin/sh /usr/bin/mysqld_safe --pid-file=/run/mysql
root /usr/libexec/mysqld --basedir=/usr --datadir=/var/mysql --user=r
root -sh
root ps
. 如上所示,1468进程执行用户是www-data无法访问到1485进程的php-cgi,因为这个root权限。 三、解决办法:
cat /etc/nginx/nginx.conf
user root;
......