jeecg+tomcat+nginx+websocket配置
jeecg结合nginx部署时出现难题。我在申请了一个2级域名a.test.com 。想通过这个域名访问jeecg
nginx.conf的与websocke相关的核心相关配置如下:
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream tomcat8080 {
server localhost:8080;
}
server {
listen 80;
server_name a.test.com;
charset UTF-8;
location / {
indexindex.jsp index.htm index.html;
proxy_pass http://tomcat8080;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location^~/WebSocket {
proxy_pass http://tomcat8080;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
web程序的配置 (我发布在root里面)
1.chat_config.properties
domain=http://localhost:8080
2.config.js
var socket = new WebSocket("ws://"+chatIp+"/WebSocket/"+id);
tomcat运行后,发现二级域名能正常访问到程序,但聊天程序失效了。
请教各路大神,是哪个地方配得不对吗
页:
[1]