微信小程序连接websocket配置
/* process.env.NODE_ENV设置生产环境模式 */
/*JAVA app.java.jnpfsoft.com NET dotnet.jnpfsoft.com*/
// 113.219.192.106 http://192.168.2.117:30000
// #ifndef MP
const baseURL = process.env.NODE_ENV === "production" ?
"https://xmszh.xjjt.com.cn:30000" : "https://zjdsj.com.cn" // 接口前缀
const define = {
copyright: "",
sysVersion: "V3.4.7",
baseURL: baseURL,
webSocketUrl: process.env.NODE_ENV === "production" ? "wss://xmszh.xjjt.com.cn/websocket" :
"wss://zjdsj.com.cn/api/message/websocket",
comUploadUrl: baseURL + '/api/file/Uploader/',
timeout: process.env.NODE_ENV === 'production' ? 1000000 : 1000000,
report: process.env.NODE_ENV === 'development' ? 'http://localhost:8200' : baseURL + '/Report'
}
// #endif
// #ifdef MP
const baseURL = "https://zjdsj.com.cn" // "https://app.java.jnpfsoft.com"
const define = {
copyright: "",
sysVersion: "V3.4.7",
baseURL: baseURL,
webSocketUrl: "wss://zjdsj.com.cn/api/message/websocket", //"wss://app.java.jnpfsoft.com/api/message/websocket"
comUploadUrl: baseURL + '/api/file/Uploader/',
timeout: process.env.NODE_ENV === 'production' ? 1000000 : 1000000,
report: baseURL + '/Report'
}
// #endif
export default define
ngin配置
server {
listen 80;
listen 443 ssl;
server_name 80;
#ssl证书,把ssl证书放cert目录下,cert在nginx的conf目录下
#把证书放进conf目录下 然后就是对应着填写
ssl_certificate /www/server/nginx/cert/full_chain.pem;
ssl_certificate_key /www/server/nginx/cert/private.key;
ssl_session_timeout 5m;
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;
location /api/ {
proxy_send_timeout 150s;
proxy_read_timeout 150s;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://113.219.192.106:30000/api/;
# 关键配置 start
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 关键配置 end
}
}