nginx作為反向代理 支援ws wss 的相關配置
阿新 • • 發佈:2019-02-15
ws相關配置
upstream 域名.com {
server ip:port;
}
server {
listen 80 ;
server_name 域名.com;
location / {
proxy_pass http://域名.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
access_log /data0/logs/域名.com.log nginx_log;
}
wss相關配置
upstream 域名.com {
server ip:port;
}
server {
listen 443 http2 ssl;
server_name 域名.com;
ssl on;ssl_certificate /etc/conf/sinashow.com.cer;
ssl_certificate_key /etc/conf/sinashow.com.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://域名.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /data0/logs/域名.com.log nginx_log;
}