[英]Certbot/LetsEncrypt HTTPS for NGINX reverse proxy not working
I've been trying to set up SSL for my websites to no avail. 我一直试图为我的网站设置SSL无济于事。 I'm using NGINX on Ubuntu 18.04 as a reverse proxy for two NodeJS Express web servers.
我在Ubuntu 18.04上使用NGINX作为两个NodeJS Express Web服务器的反向代理。 I used Certbot following these instructions .
我按照这些说明使用Certbot。 However, when trying to access my site via HTTPS, I get a "Site can't be reached"/"Took too long to respond" error.
但是,当尝试通过HTTPS访问我的网站时,出现“无法访问网站” /“花太长时间无法响应”错误。
Here's what my NGINX config in /etc/nginx/sites-available
looks like: 这是我在
/etc/nginx/sites-available
NGINX配置:
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;
}
}
When I replace the listen [::]:443 ssl
and listen 443 ssl
lines with listen 80;
当我替换
listen [::]:443 ssl
并用listen 80;
listen 443 ssl
listen 80;
and try to access the site with HTTP, it works fine. 并尝试使用HTTP访问该站点,效果很好。
Any idea what the problem might be? 知道可能是什么问题吗?
EDIT: Also, I feel I should mention that my UFW status has 22/tcp (LIMIT), OpenSSH (ALLOW), and Nginx Full (ALLOW), as well as their v6 counterparts 编辑:另外,我觉得我应该提到我的UFW状态为22 / tcp(LIMIT),OpenSSH(ALLOW)和Nginx Full(ALLOW),以及它们的v6版本
It turns out the DigitalOcean firewall was not allowing HTTPS connections. 事实证明,DigitalOcean防火墙不允许HTTPS连接。 I allowed HTTPS and switched
proxy_pass https://localhost:3001;
我允许HTTPS并切换
proxy_pass https://localhost:3001;
to http://
and everything works now! 到
http://
,现在一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.