. Advertisement .
..3..
. Advertisement .
..4..
Hi everyone, I’m learning about php. While working, I try check the nginx error log after updating nginx to version 1.19. As a result, I get the message:
2021/03/24 06:25:50 [error] 56837#56837: *7775 connect() failed (111: Connection refused) while connecting to upstream, client: 85.208.98.19, server: bienestarmutuo.org, request: "GET /ten-principles-of-the-new-education/ HTTP/1.1", upstream: "fastcgi://10.64.10.43:8050", host: "mutualwelfare.org"
What can I do about the “connect() failed (111: connection refused) while connecting to upstream” issue? Is there a better approach?
The cause: I think this error occurs because of the use of different port “name” in nginx and php.
Solution:
Access your php5-fpm by opening the following path.
or if you are the root administrator
Then locate this line and remove the comment:
With this fix, your vhost blocks will allow you to utilize listen = 127.0.0.1:9000
like this: fastcgi_pass 127.0.0.1:9000;
You only need to restart or reload Nginx and PHP5-fpm after making the changes.
Php5-fpm
or
Nginx
or
From the comments:
Also comment
and add
It took many hours to locate the root cause of the problem (many install, purge).
Problem was for me the use of different port names in nginx or php.
in php (/etc/php/8.0/fpm/pool.d/bienestarmutuo-org8050.conf) i have
in nginx (/etc/nginx/sites-available/bienestarmutuo.org.conf) i have
This was modified to:
In nginx
In php
All things work again after restarting php or nginx.
Note: Use 127.0.0.1 instead localhost to save a DNS lookup
I found the best solution was to use the same ipport reference in both PHP and nginx -> 127.0.0.1