我在我的Raspberry Pi上运行nginx服务器,它似乎使用HTTP协议正常工作。 最近,我决定向我的服务器添加HTTPS支持,并从Let's Encrypt获得证书。 如果您从本地网络发送请求,它仍然像一个魅力。但是,通过HTTPS的每个外部请求都以504 Gateway Timeout错误结束。
这是我的配置:
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;
}
}
答案 0 :(得分:0)
发现我的ISP默认启用了防火墙服务。它阻止了所有到443端口的连接。禁用它解决了我的问题。