我有三个关于证书的文件:
- example.com.ca-bundle # contains root and intermediate certificates
- example.com.crt # Certificate
- example.com.p7b # only contains certificates and chain certificates我需要配置NGINX来接受HTTPS,但我感到有点困惑,因为我对SSL没有最丰富的经验,而且大多数示例似乎都使用了证书/密钥对。这种NGINX配置是否是正确的方法?
server {
listen 443 ssl;
server_name www.example.com;
ssl_certificate /path/to/example.com.crt;
ssl_certificate_key /path/to/example.com.crt;
...
}发布于 2022-01-13 21:43:52
正如其他人在注释中指出的那样,您需要为ssl_certificate_key使用私钥。如果有进一步的帮助,下面是使用SSL证书加密Nginx配置的摘录。在某些情况下,cert.pem是不够的,而且为了跨更多的浏览器和服务器类型进行兼容性,还需要chain.pem。
# Full chain fullchain.pem is just a concatenation of public key cert.pem and chain.pem. If you are using certbot this will be automatically created.
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# Like others pointed out in the comments there should be a private key and not the cert file
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;您可以使用certbot (让我们加密的一个工具)来自动生成证书。下面是与自动为Nginx托管网站安装HTTPS / SSL证书的一步一步的说明的链接
https://stackoverflow.com/questions/68392301
复制相似问题