我正在尝试为使用webrtc kurento媒体服务器的网站配置o代理。一切正常,除了使用nginx代理时无法连接到媒体服务器。
这里是我的nginx配置
server {
listen 80;
server_name xxx.xxx.xxx.xxx;
rewrite ^ https://$http_host$request_uri? permanent; # force redirect http to https
}
server {
listen 443;
ssl on;
ssl_certificate crt.crt;
ssl_certificate_key key.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
server_name xxx.xxx.xxx.xxx;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
server_tokens off;
location /one2one {
proxy_pass https://127.0.0.1/one2one;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
proxy_pass https://127.0.0.1:9000/;
}
}
我得到的错误如下
WebSocket connection to 'wss://xxx.xxx.xxx.xxx/one2one' failed: Error during WebSocket handshake: Unexpected response code: 500
我想这个问题已经由帖子的作者解决了,但是对于其他有相同问题的人,我想为kurento媒体服务器共享我的nginx代理配置。服务器在端口443上侦听。
location /kurento {
# prevents 502 bad gateway error
proxy_buffers 8 32k;
proxy_buffer_size 64k;
# redirect all HTTP traffic to localhost:8088;
proxy_pass http://127.0.0.1:8888/kurento;
# enables WS support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 999999999;
}
通过wss://xxx.xxx.xxx.xxx/kurento访问套接字。