Line
IT Knowledgebase
< All Topics
Print

Upstream connection to Nginx fails with error:connect() failed (111: Unknown error)

I’m running a Ubuntu server on AWS and wanted to upgrade the OS. To do so, I spun up a new AWS instance with the latest version of Ubuntu (22.04) and recreated the server from scratch. After getting everything installed, I swapped the IP addresses of the old and new servers to avoid having to redo the DNS records.

At this point, nginx was up and running and happy with my config. Everything looks the same as it did on the old server. But every request to my index.php script, I got a nginx 404 error.

After 2 hours of troubleshooting, I noticed that in my nginx.conf, my upstream server is listening on 127.0.0.1:9000

while in the php-fpm config (/etc/php/8.2/fpm/pool.d/www.conf), it is listening on a unix socket!

I corrected the mistake (update server to listen on 127.0.0.1:9000) and reload php-fpm and my issue is now resolved.

Messenger