Nginx为websocket配置反向代理

时间:2020-04-12 21:09:21

标签: ssl nginx

我当前在端口:5443上配置了Antmedia服务器 在同一服务器上,端口443具有在Nginx中配置的有效SSL证书。 Nginx充当Apache的反向代理。

以下是通过Antmedia中的Websocket请求的网址。

'wss://server.com:5443/NewSample/websocket?rtmpForward=true'

此URL存在问题,因为它不安全。

''wss://server.com/NewSample/websocket?rtmpForward=true'

此网址是有问题的,因为它是404的

想知道如何配置Nginx以通过SSL执行相关的反向代理解析,以将端口转发到PORT 5443?

目前,我已经尝试了以下方法。但是当我的websocket请求通过安全Web套接字WSS://传入时,我不太确定HTTPs://的相关性。

端口444是Apache上的SSL。 443是Nginx。

任何帮助表示赞赏。

server {
            listen 443 ssl;
            ssl_certificate /etc/letsencrypt/live/sub.domain.com/fullchain.pem;
                ssl_certificate_key /etc/letsencrypt/live/sub.domain.com/privkey.pem;
            server_name sub.domain.com;

            location / {
                proxy_pass https://sub.domain.com:444
                proxy_http_version 1.1;
                proxy_connect_timeout 7d;
            proxy_send_timeout 7d;
        proxy_read_timeout 7d;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "Upgrade";
            }
        }

0 个答案:

没有答案