I am getting the following error on error log for my LEMP Ubuntu 20.04 setup on NGINX
704#704: *58 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx server: domain.tld, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "domain.tld"
My domain configuration is as follows listed under /etc/nginx/conf.d/domain.conf
server_name domain.tld;
root /var/www/domain/;
index index.html index.php;
access_log /sites/domain/logs/access.log;
error_log /sites/domain/logs/error.log;
# Don't allow pages to be rendered in an iframe on external domains.
add_header X-Frame-Options "SAMEORIGIN";
# MIME sniffing prevention
add_header X-Content-Type-Options "nosniff";
# Enable cross-site scripting filter in supported browsers.
add_header X-Xss-Protection "1; mode=block";
# Prevent access to hidden files
location ~* /\.(?!well-known\/) {
deny all;
}
# Prevent access to certain file extensions
location ~\.(ini|log|conf)$ {
deny all;
}
# Enable WordPress Permananent Links
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
configuration under /etc/nginx/sites-available/ is attached
server {
listen 80;
listen [::]:80;
root /var/www/csgg;
index i index.php index.html index.htm;
#server_name csgg.in;
client_max_body_size 100M;
autoindex off;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Can someone shed some light on how to get PHP-FPM to start behaving normally? I am able to access .txt and .HTML files in the root folder.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Hi @csggindo,
It seems you are using Nginx as a Proxy. In your domain.conf configuration file you’ve added the following block
This will redirect all .php files to localhost on port 9000. If nothing is listening on that port then your server won’t be able to serve anything hence throwing that error.
I’ll recommend removing the proxy pass to see if everything would work.
Regards, KFSys