【发布时间】:2020-05-24 10:09:19
【问题描述】:
我在浏览器上遇到的确切错误:
This server could not prove that it is XXX.XX.XXX.XXX; its security certificate is from newDomain.live. This may be caused by a misconfiguration or an attacker intercepting your connection.
NGINX 配置:
server {
# listen on port 443 (https)
listen 443 ssl;
server_name _;
# location of the self-signed SSL certificate
ssl_certificate /home/ubuntu/certs/server.pem;
ssl_certificate_key /home/ubuntu/certs/server.key;
# write access and error logs to /var/log
access_log /var/log/app_access.log;
error_log /var/log/app_error.log;
location / {
# forward application requests to the gunicorn server
proxy_pass http://localhost:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
我做了什么:
- 在终端运行
openssl req –new –newkey rsa:2048 –nodes –keyout server.key –out server.csr - 将
server.csr从服务器复制到 SSL 提供商,因为它要求网络托管提供 CSR - 提供商颁发的 SSL 证书有两个字段 1. 服务器证书 2. CA 证书(中间和根)
- 此时我已经检查过,但仍然未经验证,无法建立https连接。
- 然后,我从服务器中删除了
server.csr文件,并通过复制 SSL 提供商提供的“1. 服务器证书”创建了一个新文件。
我正在使用 AWS EC2 实例并将 NGINX 作为反向代理运行。如何解决 SSL 的这种错误配置?
【问题讨论】:
标签: nginx networking amazon-ec2 openssl ssl-certificate