代码之家  ›  专栏  ›  技术社区  ›  sunwarr10r

在certbot nginx网站不工作之后

  •  2
  • sunwarr10r  · 技术社区  · 7 年前

    之后 installing and running certbot successfully ,我的网站显示以下错误消息:


    example.com网站重定向你太多次了。 试着清理你的饼干。

    我的 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
    }
    

    /etc/letsencrypt/options-ssl-nginx.conf 如下所示:

    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 -I http://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/
    

    如果我跑了 curl -I https://example.com ,我明白了:

    HTTP/1.1 200 OK
    

    但浏览器仍然显示 This page isn’t working

    在这之前一切都很顺利。有人知道会出什么问题吗?

    0 回复  |  直到 6 年前