Python certbot nginx网站发布后’;行不通

Python certbot nginx网站发布后’;行不通,python,nginx,flask,certbot,Python,Nginx,Flask,Certbot,之后,我的网站会显示以下错误消息: 此页面不工作 example.com重定向您的次数太多。 试着清理你的饼干。 错误\u太多\u重定向 我的nginx服务器配置(/etc/nginx/sites available/myapp)如下所示: server { listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed

之后,我的网站会显示以下错误消息:

此页面不工作
example.com重定向您的次数太多。 试着清理你的饼干。 错误\u太多\u重定向

我的
nginx
服务器配置(
/etc/nginx/sites available/myapp
)如下所示:

server {

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/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_name www.example.com example.com;
    location / {
        proxy_pass http://127.0.0.1:8000;
    }

}

server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name www.example.com example.com;
    return 404; # managed by Certbot
}
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-$
/etc/letsencrypt/options ssl nginx.conf
的选项如下所示:

server {

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.com/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_name www.example.com example.com;
    location / {
        proxy_pass http://127.0.0.1:8000;
    }

}

server {
    if ($host = www.example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name www.example.com example.com;
    return 404; # managed by Certbot
}
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

ssl_ciphers "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-$
如果我运行
curl-Ihttp://example.com
,我明白了:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 10 Dec 2018 08:03:37 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://example.com/
HTTP/1.1 200 OK
如果我运行
curl-Ihttps://example.com
,我明白了:

HTTP/1.1 301 Moved Permanently
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 10 Dec 2018 08:03:37 GMT
Content-Type: text/html
Content-Length: 194
Connection: keep-alive
Location: https://example.com/
HTTP/1.1 200 OK
但是浏览器仍然显示此页面不工作


在此之前,一切正常。有人知道什么地方出了问题吗?

你能展示一下
/etc/letsencrypt/options ssl nginx.conf
的内容吗?@OrtomalaLokni我已经更新了帖子你在
/etc/nginx/网站上还有其他文件吗?如果是的,你能把它包括在你的问题中吗?好的,我有一些问题:1,为什么你的端口80支架有2个如果你要在它们中都做相同的事情,你可以放一个位置,然后做任何事情。应用程序是否进行任何重定向?尝试进入web浏览器,打开“开发工具”(F12),查看您通过了哪些重定向。@OrtomalaLokni没有其他文件