Nginx gives 502 Bad Gateway

I'm trying to start Jenkins in Docker container

This is my Nginx config:

server {
    server_name  ci.azat.io;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/ci.azat.io/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/ci.azat.io/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
}

server {
    if ($host = ci.azat.io) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen       80;
    server_name  ci.azat.io;
    return 404; # managed by Certbot
}

When I'm trying to open server in 8080 port I get 502 error. Could you help me to tell what is wrong here?



Read more here: https://stackoverflow.com/questions/64597431/nginx-gives-502-bad-gateway

Content Attribution

This content was originally published by Azat S. at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: