0

I'm trying to set up an Nginx webserver generally following this guide but using perusio's configuration. When I try to access the site, I get a 502 Bad Gateway page.

Searching on the error I've seen a few people report that setting the fastcgi buffer size has fixed their problem. However, this did not work for me. Though the messages in my error log are different than those stated:

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

Searching on this error, it seems that nginx is not communicating with php5-fpm. I've verified that php5-fpm is running:

$ 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

And listening:

$ 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-

And my nginx.conf includes upstream_phpcgi_unix.conf so it should be trying to connect to php5-fpm via Unix sockets:

## 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;
}

What else should I be looking at?

0

I was able to solve the problem by using aptitude purge to remove all of the PHP packages and their configuration files along with nginx. I then reinstalled each PHP package individually as it became necessary. I also used perusio's PHP-FPM configuration files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.