#配置wss开始-----/ws /DataReal/ 路径后还有参数配置如下:----------
location ^~ /ws/DataReal/ {
proxy_pass http://192.168.9.105:9011/ws/DataReal/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_connect_timeout 600s;
proxy_read_timeout 600;
proxy_send_timeout 600s;
}
#配置wss结束------------------------------------------
#配置wss开始---/ws /liveRoom/ 路径后没有参数配置如下:----------
location /ws/liveRoom {
proxy_pass http://172.21.0.17:8780/ws/liveRoom;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_connect_timeout 600s;
proxy_read_timeout 600;
proxy_send_timeout 600s;
}
#配置wss结束------------------------------------------
样例:?
server{
listen 80;
server_name icp-udg.seewaysoft.com;
#把http的域名请求转成https
rewrite ^(.*)$ https://$host$1 permanent;
location ^~ /ws/DataReal/ {
proxy_pass http://192.168.9.105:9011/ws/DataReal/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_connect_timeout 600s;
proxy_read_timeout 600;
proxy_send_timeout 600s;
}
location /api {
proxy_pass http://192.168.9.105:9011/api;
client_max_body_size 5000m;
}
}
server{
listen 443 ssl;
listen [::]:443 ssl;
server_name icp-udg.seewaysoft.com;
ssl_certificate /usr/local/nginx/cert/7742803_icp-udg.seewaysoft.com.pem;
ssl_certificate_key /usr/local/nginx/cert/7742803_icp-udg.seewaysoft.com.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置
ssl_prefer_server_ciphers on;
if ($scheme = http) {
return 301 https://$server_name$request_uri;
}
location ^~ /ws/DataReal/ {
proxy_pass http://192.168.9.105:9011/ws/DataReal/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-NginX-Proxy true;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_connect_timeout 600s;
proxy_read_timeout 600;
proxy_send_timeout 600s;
}
location /api {
proxy_pass http://192.168.9.105:9011/api;
client_max_body_size 5000m;
}
}
|