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!
Hi @csggindo,
It seems you are using Nginx as a Proxy. In your domain.conf configuration file you’ve added the following block
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;
}
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.