I have Nginx running on Ubuntu server (digital ocean), I've setup LEMP stack for hosting the Wordpress website. I'm getting 501 Bad Gateway when I try to reach website using the IP address.
I see this errors in the log:
2022/05/24 14:43:52 [error] 199802#199802: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 212.58.120.29, server: localhost, request: "GET /ttemp.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "46.101.238.240"
2022/05/24 14:43:52 [error] 199802#199802: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 212.58.120.29, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "46.101.238.240", referrer: "https://46.101.238.240/ttemp.php"
And here's my Nginx config:
server {
listen 80;
listen 443 ssl;
ssl_certificate /var/www/ssl/default.crt;
ssl_certificate_key /var/www/ssl/default.key;
server_name localhost mydomain.com www.mydomain.com;
root /var/www/mydomain.com;
error_log /var/log/nginx/error.log info;
location / {
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
And my UFW status:
To Action From
-- ------ ----
Nginx HTTP ALLOW Anywhere
Nginx HTTPS ALLOW Anywhere
22/tcp ALLOW Anywhere
22 ALLOW Anywhere
2222 ALLOW Anywhere
3306 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
9000 ALLOW Anywhere
Nginx HTTP (v6) ALLOW Anywhere (v6)
Nginx HTTPS (v6) ALLOW Anywhere (v6)
22/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
2222 (v6) ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
9000 (v6) ALLOW Anywhere (v6)
Any ideas?