nginx代理wss
# nginx配置
修改/etc/nginx/nginx.conf配置文件:
server { listen 443 ssl http2; server_name _; root /usr/share/nginx/html; //nginx配置SSL证书的地方。 ssl_certificate "/etc/pki/nginx/www.ddrj.com.crt"; ssl_certificate_key "/etc/pki/nginx/www.ddrj.com.key"; ssl_session_cache shared:SSL:1m; ssl_session_timeout 10m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /40x.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } //wss转发的配置 location ^~ /sip { proxy_pass http://192.168.31.213:8000/; //这里的IP修改成服务器的内网IP,端口与中间件配置的ws端口一致。 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_read_timeout 60s; proxy_set_header Upgrade websocket; proxy_set_header Connection Upgrade; } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38检查配置文件的格式是否正确,SSH控制台执行命令:
nginx -t
如果输出结果如以下所示,说明文件的格式没有问题:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
1
2nginx配置生效的命令:
nginx -s reload
# 中间件配置修改
# 修改acl.conf配置文件
CCAdmin-Web->呼叫中心->配置文件设置->找到acl.conf配置文件->新增以下配置:
<list name="mylan" default="deny"> </list>
1
2CCAdmin-Web->运维调试->FS终端->点击"reloadacl"按钮,使acl配置生效。
# 修改sip配置
CCAdmin-Web->呼叫中心->SIP设置->找到internal配置->按要求修改以下参数:
local-network-acl
:修改成mylan
。ws-binding
:内网IP:ws端口。例:192.168.31.213:8000,ws端口与nginx中的转发配置的端口一致。
CCAdmin-Web->运维调试->FS终端->执行命令:
reload mod_sofia
,使sip配置生效。
# 分机注册
浏览器访问地址:https://www.ddrj.com/jssip/index.html (opens new window),开始注册分机:
用户名
:分机号。密码
:分机密码。WSS
:域名/sip。(注意:这里的域名后面需要带sip路径)
上次更新: 2025/06/09, 15:36:28