0

I had a particularly outdated ubuntu distribution (12.10) and was beginning the process to update sequentially to 16.04. Yesterday, I successfully updated from 12.10->13.10->14.04 using the Ubuntu old releases archive and this tutorial from Digital Ocean. I didn't have to change the kernel, because our droplet was using grubloader v2.0.

Excited at the success of updating, I used do-release-upgrade to move from 14.04 to 16.04 and, while the distribution was updated successfully, I immediately ran into 502 errors (nginx /1.4.6) after updating. I am new to all of this, so I did the release upgrade from 14.04 to 16.04 in the exact same way as the 13.10->14.04 upgrade.

Has anyone run into this problem when updating from 14.04->16.04? Also, I restored my droplet back to 12.10 and updated back to 14.04 and I am now running into the same 502 errors, despite the 14.04 update working fine previously.

Here are my error logs from today (the 14.04 version 502 errors):

2018/03/22 10:01:08 [crit] 774#0: *58351 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 46.229.168.67, server: localhost, request: "GET /tag/love-me-some-cats/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "wesleying.org"

Has anyone ever run into an issue like this and/or know a quick fix for a novice?

kubanczyk
  • 13,812
  • 5
  • 41
  • 55
  • Make sure your PHP-FPM is running. The log sais your sock file does not exist. What is the reesult for `ls -lah /var/run`? – Bert Mar 22 '18 at 15:31
  • The log entry you posted (with, strangely, a lot of extra space inserted) says "Permission denied". So check the permissions on the socket. – Michael Hampton Mar 22 '18 at 16:33
  • The socket used to be world-writable (insecure). Today, you usually want `listen.group` entries in your fpm config. Simply upgrading ancient php5-fpm configs to currently supported ones will not necessarily make those changes for you. – anx Mar 27 '18 at 15:12

1 Answers1

0

Nginx connects your PHP FPM via an unix socket. Depending on the used version, which may differ from OS version to OS version, the name of the socket or the location may be different. As well as sometimes you don't have a socket, you have a port.

See how your PHP FPM provides it's service

netstat -nlp | grep php

The result can be a port or an unix socket or you can have multiple results (e.g. different for different PHP versions).

Example result

unix  2      [ ACC ]     STREAM     HÖRT         34042019 19073/php-fpm.conf) /run/php/php5.6-fpm.sock

Update your Nginx accordingly

fastcgi_pass unix:/run/php/php5.6-fpm.sock;

and reload your web server

service nginx reload
Jens Bradler
  • 6,503
  • 2
  • 17
  • 13