Ich gegen das Web

Der Blog von jemanden der gegen das Web kämpft.

Über diesen Blog

Sebastian schreibt hier manchmal über seinen Kampf gegen das Internet. Wer da wohl gewinnt?

Zahl des Tages

9

Navigation

When nginx cannot connect to the your php fpm sock

when-nginx-cannot-connect-to-the-your-php-fpm-sock

Today was one of these days, where I getting an error on my play server out of nowhere. I changed not much in the last days so I was a little confused about that. One of the websites was unable to work. I received a 502 Bad Gateway error. The error log from the Nginx showed the following:

2020/12/07 20:22:00 [crit] 1846#1846: *5 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 89.***.***.***, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/website.sock:", host: "www.website.de"
2020/12/07 20:22:00 [crit] 1846#1846: *5 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 89.***.***.***, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/example.sock:", host: "www.example.com"
2020/12/07 20:22:01 [crit] 1846#1846: *5 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 89.***.***.***, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/example.sock:", host: "www.example.com"
2020/12/07 20:22:47 [crit] 1878#1878: *127 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 89.***.***.***, server: example.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/example.sock:", host: "www.example.com"
2020/12/07 20:23:45 [crit] 1878#1878: *147 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 207.***.***.***, server: example.com, request: "GET /2017-April-Marek-Konwa HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/example.sock:", host: "www.example.com"
2020/12/07 20:24:24 [crit] 1878#1878: *288 connect() to unix:/var/run/php/example.sock failed (2: No such file or directory) while connecting to upstream, client: 36.***.***.***, server: example.com, request: "GET /video-277.html?fbclid=IwAR2j2xofNyjzUh0hbnweMESDGhYIdC0qMn1IR5qDln8vktcedR-6LPv_k68 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/example.sock:", host: "www.example.com", referrer: "https://l.facebook.com/"

First I checked the socks and found ... nothing:

root@play:~# ls -lsa /var/run/php/
total 3
0 drwxr-xr-x  2 www-data www-data 120 Dez  7 20:27 .
0 drwxr-xr-x 27 root     root     840 Dez  7 20:28 ..
0 srw-rw----  1 www-data www-data   0 Dez  7 20:27 dev.example.sock
4 -rw-r--r--  1 root     root       4 Dez  7 20:27 php7.2-fpm.pid
0 srw-rw----  1 www-data www-data   0 Dez  7 20:27 php7.2-fpm.sock

So what happened? After thinking about the so-called Nginx socket leak (see https://www.nginx.com/resources/wiki/start/topics/tutorials/debugging/#socket-leaks) I rethought my changes in the last days. I just added a subdomain to example.com (subdomain dev.example.com). I isolated the dev with their own PHP pool. The directions and permission were correct. While I reviewed the pool configs, I realized that I named the pools the same. dev.example.com AND example.com were configurated under [example]. And that was the problem. PHP was still able to start, but instead of throwing an error, the two configs (which different socks) were running under the newer sock (dev.example.sock).

The fix: just change the name of the pool (now I had two pools [dev.example] and [example]) and restart the PHP service. That's it.

Dezember 7, 2020

Es wurden noch keine Kommentare verfasst, sei der erste!