ssl - NGINX 反向代理的 Certbot/LetsEncrypt HTTPS 不起作用
问题描述
我一直在尝试为我的网站设置 SSL 无济于事。我在 Ubuntu 18.04 上使用 NGINX 作为两个 NodeJS Express Web 服务器的反向代理。我按照这些说明使用了 Certbot 。但是,当尝试通过 HTTPS 访问我的站点时,我收到“无法访问站点”/“响应时间过长”错误。
这是我的 NGINX 配置的/etc/nginx/sites-available
样子:
server {
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
server_name MYURL.com www.MYURL.com;
ssl on;
ssl_certificate /etc/letsencrypt/live/MYURL.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/MYURL.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
access_log /var/log/nginx/MYURL.access.log;
error_log /var/log/nginx/MYURL.error.log;
client_max_body_size 50M;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass https://localhost:3001;
}
}
当我将listen [::]:443 ssl
andlisten 443 ssl
行替换为listen 80;
并尝试使用 HTTP 访问该站点时,它工作正常。
知道问题可能是什么吗?
编辑:另外,我觉得我应该提到我的 UFW 状态有 22/tcp (LIMIT)、OpenSSH (ALLOW) 和 Nginx Full (ALLOW),以及它们的 v6 对应状态
解决方案
事实证明 DigitalOcean 防火墙不允许 HTTPS 连接。我允许 HTTPS 并切换proxy_pass https://localhost:3001;
到http://
,现在一切正常!
推荐阅读
- python - numpy中的累积分布函数未达到1?
- python - Appium Android Python - 使用文本属性查找元素
- c# - 找不到类型或命名空间“NModel”
- python - 生成器在 python 中的 yield return 是什么,这与 return 有什么不同
- node.js - electron - node.js - ng : 无法加载文件路径\ng.ps1,因为在此系统上禁用了运行脚本
- python - Pycharm 2019 未显示 print() 输出;但退出代码 0。我该如何解决?
- asp.net-core - ASP.NET Core - HealtCheck 消息中的异常
- scala - Elastic4S - Jackson 的 ScalaObjectMapper 类未找到并抛出 NoSuchMethodError
- android - 保持一个应用程序android连接到服务器的最佳方法是什么
- arrays - 如何将 find 的结果存储在 bash 数组中,以将结果用作 bash 脚本中的文件路径?