如何解决我在 Ubuntu 服务器上使用带有 certbot 的 Nginx 设置 https 失败,并显示 ERR_ADDRESS_UNREACHABLE
我的目标是让 Nginx 在使用 https 时返回它的示例欢迎页面。
我使用 certbot 通过以下命令创建证书:
certbot --nginx -d api.example.com
在我的/etc/nginx/conf.d/nginx-example-server.conf
我有以下块:
server {
listen 443 ssl;
server_name api.example.com
ssl_certificate /etc/letsencrypt/live/api.example.com/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/api.example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
}
include /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: "<Lots of cyphers>"
ufw status verbose
返回:
Status: active
Logging: on (low)
Default: deny (incoming),allow (outgoing),disabled (routed)
New profiles: skip
To Action From
-- ------ ----
443/tcp ALLOW IN Anywhere # Open all to access Nginx port 443
80/tcp ALLOW IN Anywhere # Open access Nginx port 80
22/tcp ALLOW IN Anywhere # Open access OpenSSH port 22
8000 DENY IN Anywhere
443/tcp (v6) ALLOW IN Anywhere (v6) # Open all to access Nginx port 443
80/tcp (v6) ALLOW IN Anywhere (v6) # Open access Nginx port 80
22/tcp (v6) ALLOW IN Anywhere (v6) # Open access OpenSSH port 22
8000 (v6) DENY IN Anywhere (v6)
如果我访问 https://api.example.com(当然不是真正的网址),它会以 ERR_ADDRESS_UNREACHABLE
响应。
/var/log/nginx/access.log
和 /var/log/nginx/error.log
都没有记录关于 ERR_ADDRESS_UNREACHABLE
的任何内容。
我试图找到我的 ufw
日志文件,但没有。我试图按照此处所述找到它们:https://serverfault.com/a/516840
我四处寻找技巧并学习了一些教程。一切都会导致相同的响应。不过,我可以通过 http 成功访问 Nginx 欢迎页面。
非常欢迎帮助!即使这只是调试这个东西的更好方法。
解决方法
修复了它:sudo iptables -I INPUT -p tcp --dport 443 -j ACCEPT
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。