Unable to get secure connection when getting it configured with nginx, letsencrypt and uwsgi

后端 未结 1 1405
遇见更好的自我
遇见更好的自我 2021-01-28 08:41

I am struggling with an issue where I am unable to get my Flask app with a secure connection. Whenever I open my site then I get a yellow exclamation mark which says my connecti

相关标签:
1条回答
  • 2021-01-28 09:05

    I think the issue you are facing might be related to Firefox...

    Can you confirm if you have the Root CA of Lets Encrypt (https://letsencrypt.org/certificates/)

    If "Let's Encrypt Authority X3" is missing then download the root from above url and add it to Mozilla Firefox.

    My other suggestion would be to refer below for updating your nginx conf... NOTE: any http requests will be forced to take https from below and to only www. so make changes if your app supports without www

    server {
        server_name truejet.in www.truejet.in;
        return 301 https://$server_name$request_uri;
    }
    
    server 
    {
        listen 443 ssl http2 default_server;
        listen [::]:443 ssl http2 default_server ipv6only=on;
    
        server_name www.truejet.in truejet.in;
    
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
    
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_certificate /etc/letsencrypt/live/www.truejet.in/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/www.truejet.in/privkey.pem;
        ssl_trusted_certificate /etc/letsencrypt/live/www.truejet.in/fullchain.pem;
        ssl_dhparam /etc/letsencrypt/live/www.truejet.in/dhparam.pem;
    
        client_max_body_size 5M;
    
        location / {
            proxy_buffering off;
            proxy_pass http://0.0.0.0:5000;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Referer "";
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header X-Forwarded-SSL on;
            proxy_set_header Connection "upgrade";
            proxy_http_version 1.1;
        }
    
        location ~ /.well-known {
            allow all;
            # You can add the path to the Challenge
            #root /usr/share/nginx/html;
        }
    
        resolver 8.8.8.8 8.8.4.4 valid=300s;
    }
    
    0 讨论(0)
提交回复
热议问题