0

I read this article from a couple months back 502 Bad Gateway nginx php7 fpm

I tried a bunch of stuff but I am still getting a 502 bad gateway error.

When I look at the error log I get the following:

2017/02/08 08:46:34 [error] 1482#1482: *166935 connect() to unix:/run/php/php7.0-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 191.96.249.70, server: example.com, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "xx.xx.xx.xx"

I have a fresh install of Ubuntu 16.04 with the current updates. My RAM memory is as follows:

server:~$ free -m
          total        used        free      shared  buff/cache   available
Mem:           2000         337         961          47         700        1444
Swap:          1021           0        1021

In the nginx config file there is a bunch of stuff but here is the relevant code:

upstream php {
            server unix:/tmp/php-cgi.socket;
            server  127.0.0.1:9000;
    }

location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_read_timeout 150;
            fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

In the file /etc/php/7.0/fpm/pool.d/www.conf The listen directive is

listen = /run/php/php7.0-fpm.sock

In the directory run/php there is a file php7.0-fpm.sock

server:/run/php$ ls
php7.0-fpm.pid  php7.0-fpm.sock  php7.1-fpm.pid  php7.1-fpm.sock

The only way I can get the 502 bad gateway error to be removed from the browser is to do the following:

sudo systemclt stop php7.0-fpm
sudo systemctl start php7.0-fpm

I need to do this many times a day....of course this is not a solution. It is just restarting the service.

I noticed that in the nginx config file there are two function "upstream php" and "location ~.php" These two are pointing to different locations. Could this be an configuration error?

Not really sure as one is pointing to a server and the other a file location.

Any help would be great.

Spineless

0 Answers0