CIM 通讯框架websocket配置 nginx 代理配置
2022-02-09 本文已影响0人
yichen_china
宝塔nginx 域名配置
upstream websocket{
#websocket后台实际地址
server 223.100.17.190:8071;
}
server
{
listen 80;
listen 443 ssl;
server_name m.b.lnby.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/m.b.lnby.com;
ssl_certificate /www/server/panel/vhost/cert/m.b.lnby.com/fullchain.pem;
ssl_certificate_key /www/server/panel/vhost/cert/m.b.lnby.com/privkey.pem;
ssl_session_timeout 20m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_verify_client off;
#SSL-END
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
include /www/server/panel/vhost/rewrite/m.b.lnby.com.conf;
#REWRITE-END
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
# #一键申请SSL证书验证目录相关设置
# location ~ \.well-known{
# allow all;
# }
access_log /www/wwwlogs/m.b.lnby.com.log;
error_log /www/wwwlogs/m.b.lnby.com.error.log;
}
伪静态配置
location /ws {
#单服务配置
proxy_pass http://223.100.17.190:8071/;
#负载均衡
#proxy_pass http://websocket/;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}