upstream wss_svr {
# 示例 server domain.com:8001 weight=1;
server <您的后台:[端口]> weight=1;
}
server {
listen 443;
# 示例 server_name domain.com
server_name <您的域名>
ssl on;
# 示例 ssl_certificate /opt/certs/domain.com.cert.pem
ssl_certificate <您的证书位置>
# 示例 ssl_certificate_key /opt/certs/domain.com.key.pem
ssl_certificate_key <您的证书秘钥位置>
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
ssl_verify_client off;
location / {
proxy_redirect off;
proxy_pass http://wss_svr;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection …upgrade…;
}
}
将如上配置保存到/etc/nginx/conf.d/domain.conf(根据您的部署环境修改此处)
检查配置是否规范
/usr/sbin/nginx -t
让nginx 重新加载配置
/usr/sbin/nginx -s reload