修改配置
This commit is contained in:
74
nginx/openim-pc-proxy.conf
Normal file
74
nginx/openim-pc-proxy.conf
Normal file
@@ -0,0 +1,74 @@
|
||||
# OpenIM / PC 客户端统一入口(HTTP :80)
|
||||
# 后端均为本机 deploy-test 单机进程:openim-server、chat-api
|
||||
#
|
||||
# 安装:在测试服务器上以 root 执行
|
||||
# sudo ./deploy-test/00-init-tools.sh nginx
|
||||
#
|
||||
# 安全组 / 防火墙须放行 TCP 80;后端 10001/10002/10008 仅需本机访问(127.0.0.1)
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 100m;
|
||||
|
||||
# OpenIM HTTP API → openim-server :10002
|
||||
location /api/im/ {
|
||||
proxy_pass http://127.0.0.1:10002/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# 用户 / 登录相关 → chat-api :10008(与 im-cms-nginx 一致)
|
||||
location /api/user/ {
|
||||
proxy_pass http://127.0.0.1:10008/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# Chat API → chat-api :10008
|
||||
location /api/chat/ {
|
||||
proxy_pass http://127.0.0.1:10008/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 300s;
|
||||
proxy_send_timeout 300s;
|
||||
}
|
||||
|
||||
# MsgGateway WebSocket → openim-server :10001
|
||||
location /msg_gateway {
|
||||
proxy_pass http://127.0.0.1:10001;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
proxy_buffering off;
|
||||
proxy_read_timeout 86400s;
|
||||
proxy_send_timeout 86400s;
|
||||
}
|
||||
|
||||
# 可选:健康检查
|
||||
location = /nginx-health {
|
||||
access_log off;
|
||||
default_type text/plain;
|
||||
return 200 "ok\n";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user