我正在尝试设置一个 Nginx 网络服务器,一般如下本指南但使用perusio的配置。当我尝试访问该站点时,我收到 502 Bad Gateway 页面。
搜索错误时我看到一些人报告了这一点设置fastcgi缓冲区大小已经解决了他们的问题。但是,这对我不起作用。尽管我的错误日志中的消息与所述的不同:
2013/06/11 10:21:24 [info] 32684#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:181
2013/06/11 10:21:24 [alert] 32692#0: epoll_ctl(1, 0) failed (1: Operation not permitted)
2013/06/11 10:21:24 [alert] 32692#0: failed to register channel handler while initializing push module worker (1: Operation not permitted)
2013/06/11 10:21:24 [alert] 32691#0: epoll_ctl(1, 0) failed (1: Operation not permitted)
2013/06/11 10:21:24 [alert] 32691#0: failed to register channel handler while initializing push module worker (1: Operation not permitted)
2013/06/11 10:21:25 [alert] 32686#0: cache manager process 32691 exited with fatal code 2 and cannot be respawned
搜索此错误,似乎nginx
没有与 通信php5-fpm
。我已经验证正在php5-fpm
运行:
$ ps auxw | grep php
root 853 0.0 0.8 290416 4504 ? Ss 10:21 0:00 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
www-data 854 0.0 0.6 290416 3488 ? S 10:21 0:00 php-fpm: pool www
www-data 855 0.0 0.6 290416 3488 ? S 10:21 0:00 php-fpm: pool www
kyle 973 0.0 0.2 3824 1072 pts/0 S+ 10:42 0:00 grep php
并聆听:
$ netstat --unix -l
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 43115 /var/run/mysqld/mysqld.sock
unix 2 [ ACC ] SEQPACKET LISTENING 2674 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 4772 /var/run/fail2ban/fail2ban.sock
unix 2 [ ACC ] STREAM LISTENING 43450 /var/run/php5-fpm.sock
unix 2 [ ACC ] STREAM LISTENING 4792 @/tmp/fam-root-
我的nginx.conf
包含所以它应该尝试通过 Unix 套接字upstream_phpcgi_unix.conf
连接:php5-fpm
## Add as many servers as needed. Cf. http://wiki.nginx.org/HttpUpstreamModule.
upstream phpcgi {
## If your version of Nginx doesn't have the fair load balancer:
## https://github.com/gnosek/nginx-upstream-fair comment out the
## following line.
fair;
server unix:/var/run/php-fpm.sock;
server unix:/var/run/php-fpm-zwei.sock;
## Create a backend connection cache. Note that this requires
## Nginx version greater or equal to 1.1.4.
## Cf. http://nginx.org/en/CHANGES. Comment out the following
## line if that's not the case.
keepalive 5;
}
## Add a third pool as a fallback.
upstream phpcgi_backup {
server unix:/var/run/php-fpm-bkp.sock;
## Create a backend connection cache. Note that this requires
## Nginx version greater or equal to 1.1.4.
## Cf. http://nginx.org/en/CHANGES. Comment out the
## following line if that's not the case.
keepalive 1;
}
我还应该看什么?
答案1
我能够通过使用aptitude purge
删除所有 PHP 包及其配置文件以及nginx
.然后,我根据需要单独重新安装了每个 PHP 包。我也用过perusio 的 PHP-FPM配置文件。