I am trying to solve why I am getting on docker / nginx container error 502 with connect() failed (111: Connection refused) when I setup properly the ssl , but I got this issue . I dont see clerly where it comes from . how can I fix this?
upstream web_server {
server web:8000;
}
server {
listen 80;
server_name demo.io www.demo.io;
access_log /var/log/nginx/demo.io.log;
error_log /var/log/nginx/demo.io.log;
location / {
rewrite ^ https://$host$request_uri? permanent;
proxy_pass http://web_server;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /home/app/web/static/;
}
}
#https://demo.io
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name demo.io;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/demo.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/demo.io/privkey.pem;
ssl_buffer_size 8k;
ssl_dhparam /etc/ssl/certs/ssl-dhparams.pem;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
ssl_ecdh_curve secp384r1;
ssl_session_tickets off;
# OCSP stapling
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8;
location / {
proxy_pass https://web;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
}