简体   繁体   English

从 Nginx 将 HTTP 重定向到 HTTPS 的 Certbot 无法正常工作

[英]Certbot Redirection of HTTP to HTTPS from Nginx not working

Certbot command证书机器人命令

SSL Connection Error returned返回 SSL 连接错误

I am trying to issue an SSL certificate for my website, although the message was successful (as attached image) but when accessing that domain, it is not working我正在尝试为我的网站颁发 SSL 证书,虽然消息是成功的(如附件图像),但在访问该域时,它不起作用

如果您使用 Cloudflare,请转到 SSS/TLS 选项卡,然后转到概览,然后在页面右侧,选择完整(严格)

You must make sure to configure it in Nginx also:您还必须确保在 Nginx 中配置它:

ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/certificate_key.key;

And make sure the server is listening on port 443.并确保服务器正在侦听端口 443。

If you want to force https:// then add a new nginx server declaration listening only on port 80 with the following:如果您想强制使用https:// ,则添加一个仅在端口 80 上侦听的新 nginx 服务器声明,其中包含以下内容:

location / {
    return 301 https://$host$request_uri;
}

There may be better ways to do that also, but I have little information to go on from this question, with no further information provided, I don't even know if you already did this or not, but it wouldn't work to just generate a cert, you also have to use it.也可能有更好的方法可以做到这一点,但我从这个问题中得到的信息很少,没有提供进一步的信息,我什至不知道你是否已经这样做了,但仅仅这样做是行不通的生成证书,您还必须使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM