【发布时间】:2017-11-22 04:49:14
【问题描述】:
我需要在我的服务器上设置 SSL,并且一直在推迟,现在我已经完成了,发现它比预期的要简单得多,所以对于其他人来说,这是我遵循的过程。
我有一个专用服务器,并且已经下载了 GeoTrust 证书和私钥(由我的主机提供)。
我已将这两个文件上传到 /etc/nginx/ssl/(以 root 身份)。
我在我的 Nginx default.conf 中添加了以下内容:
server {
server_name www.example.com;
listen 443;
ssl on;
ssl_certificate /etc/nginx/ssl/www.example.com_ssl_certificate.cer;
ssl_certificate_key /etc/nginx/ssl/www.example.com_private_key.key;
location / {
allow all;
# Proxy Headers
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Cluster-Client-Ip $remote_addr;
# The Important Websocket Bits!
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://examplecom;
}
}
我已经打开了443端口,如下:
firewall-cmd --permanent --zone=public --add-port=443/tcp
并添加了https服务:
firewall-cmd --permanent --zone=public --add-service=https
我现在可以在我的域中通过 https 访问该应用程序。
最后一个问题是通过 wss 设置 Phoenix Web 套接字,我将编辑这篇文章并在完成后立即添加该信息。
某人。
Centos 7
Nginx 1.10.1
【问题讨论】:
-
感谢您的回答。我还需要一点。如何将localhost的自签名根证书添加到Centos 7/8中受信任的根ca存储中?
标签: ssl nginx centos phoenix-channels