ssl - NGINX + HTTPS 导致外部请求出现 504 Gateway Timeout 错误

标签 ssl nginx https timeout http-status-code-504

我在我的 Raspberry Pi 上运行 nginx 服务器,它似乎使用 HTTP 协议(protocol)工作得很好。 最近,我决定为我的服务器添加 HTTPS 支持,并获得了 Let's Encrypt 的证书。 如果您从本地网络发送请求,它仍然可以正常工作。但是每个通过 HTTPS 的外部请求都以 504 网关超时错误结束。

这是我的配置:

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    listen 443 ssl default_server;
    listen [::]:443 ssl default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name domain.name;

    ssl_session_cache shared:SSL:20m;
    ssl_session_timeout 180m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    ssl_prefer_server_ciphers on;
    ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DHE+AES128:!ADH:!AECDH:!MD5;

    ssl_certificate /etc/letsencrypt/live/domain.name/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/domain.name/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/domain.name/chain.pem;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

    location ~ /.well-known {
        allow all;
        root /usr/share/nginx/html;
    }
}

最佳答案

发现我的 ISP 默认启用了防火墙服务。它阻止了与 443 端口的所有连接。禁用它解决了我的问题。

关于ssl - NGINX + HTTPS 导致外部请求出现 504 Gateway Timeout 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46756648/

相关文章:

ssl - 对于 DNS 和 SSL,我是否需要为每个 (DNS RR) A 记录提供单独的证书?

configuration - 0.7.8之前的Nginx如何访问HTTP GET参数?

swift - URLSession "hostname not found",但我在浏览器中看到它

python - 我们如何使用带有 Selenium 的 Django LiveServerTestCase 来测试 https url

heroku 上的 ssl 证书 cleardb

android - WebView 中的客户端证书身份验证

database - 如何将SSL添加到后端mysql数据库并使用Laravel连接

amazon-web-services - Kubernetes nginx 入口代理传递给 websocket

php - 将所有内容传递到一个位置 nginx

node.js - 循环退出时 Node https 回调不触发