This week I SSHed into my droplet, and there was a message asking to reboot for security. So I ran the reboot command, and when the droplet was available again I ensured to restart the service I needed for my site.

Ever since then, I get a 502 error when going to the site: https://arts-et-medias.net/

I have read a few other questions about the 502 error, but I can’t make heads or tails of them.

Here are a few things that may help you help me:

The site config:

server {
    server_name arts-et-medias.net www.arts-et-medias.net;

    client_max_body_size 4M;

    location / {
        proxy_set_header HOST $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_pass http://127.0.0.1:9696;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/arts-et-medias.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/arts-et-medias.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

The errors obtained with tail -f /var/log/nginx/error.log:

2020/06/19 12:47:03 [error] 8041#8041: *343 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.66.136, server: arts-et-medias.net, request: "GET /search?page=6&append=1 HTTP/1.1", upstream: "http://127.0.0.1:9696/search?page=6&append=1", host: "arts-et-medias.net"
2020/06/19 12:51:32 [emerg] 11770#11770: invalid parameter "server_name" in /etc/nginx/sites-enabled/arts-et-medias.net.conf:7
2020/06/19 12:54:15 [error] 11868#11868: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.66.138, server: arts-et-medias.net, request: "GET /search?page=3&append=1 HTTP/1.1", upstream: "http://127.0.0.1:9696/search?page=3&append=1", host: "arts-et-medias.net"
2020/06/19 12:54:15 [error] 11868#11868: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.66.138, server: arts-et-medias.net, request: "GET /robots.txt HTTP/1.1", upstream: "http://127.0.0.1:9696/robots.txt", host: "arts-et-medias.net"
2020/06/19 12:55:33 [error] 12006#12006: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 216.246.237.36, server: arts-et-medias.net, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:9696/", host: "arts-et-medias.net"
2020/06/19 12:55:34 [error] 12006#12006: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 216.246.237.36, server: arts-et-medias.net, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:9696/favicon.ico", host: "arts-et-medias.net"
2020/06/19 13:00:40 [error] 12006#12006: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 216.246.237.36, server: arts-et-medias.net, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:9696/", host: "arts-et-medias.net"
2020/06/19 13:00:40 [error] 12006#12006: *6 connect() failed (111: Connection refused) while connecting to upstream, client: 216.246.237.36, server: arts-et-medias.net, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:9696/favicon.ico", host: "arts-et-medias.net"
2020/06/19 13:01:27 [error] 12006#12006: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.66.134, server: arts-et-medias.net, request: "GET /robots.txt HTTP/1.1", upstream: "http://127.0.0.1:9696/robots.txt", host: "arts-et-medias.net"
2020/06/19 13:01:27 [error] 12006#12006: *10 connect() failed (111: Connection refused) while connecting to upstream, client: 66.249.66.138, server: arts-et-medias.net, request: "GET /search?page=2&append=1 HTTP/1.1", upstream: "http://127.0.0.1:9696/search?page=2&append=1", host: "arts-et-medias.net"

Could anyone provide me with a solution? I am not a devops person or a backend person, so I am not interested in the why, I just want to fix it so I can go back to dealing with the content on the site. Thanks in advance.

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.

×
1 answer

Hello,

It looks like that your backend service which should be running on port 9696 was not running.

I can see that you’ve managed to fix the 502 error. Would you mind sharing how you solved the problem here with the community?

Thank you and regards,
Bobby

Submit an Answer