Nginx Ratchet通过https连接到websocket服务器时出现一些错误

问题描述

我正在使用Nginx服务器,并且有多个站点正在运行。我正在尝试设置Websocket服务器。
这是我正在使用的服务器配置

上游websocketserver {
服务器website.com:8082;
}
服务器{

             listen [::]:443 ssl http2;
             listen 443 ssl http2;

             server_name website.com;
             index index.PHP index.html index.htm;

             charset utf-8;
             client_max_body_size 50M;

             root /var/www/website.com;

             # Pass PHP scripts to the cgi server
             location ~ [^/]\.PHP(/|$) {
                     fastcgi_split_path_info ^(.+?\.PHP)(/.*)$;
                     fastcgi_pass unix:/var/run/PHP/PHP7.2-fpm.sock;
                     fastcgi_index index.PHP;
                     include snippets/fastcgi-PHP.conf;
             }

             location ~ /\.ht {
                     deny all;
             }

             ssl on;
             ssl_certificate path/cert.pem; 
             ssl_certificate_key path/privkey.pem;

             location /website.com {

                     # switch off logging
                      access_log off;

                     proxy_pass http://websocketserver;
                     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 https;
                     proxy_read_timeout 86400s;
                     proxy_send_timeout 86400s;
                     keepalive_timeout 86400s;
                     proxy_redirect off;
              }

}

Websocket服务器设置

$ app = new Ratchet \ App(“ localhost”,8082,'0.0.0.0');
$ app-> route('/ chat',new Chat,array('*'));
$ app-> run();

客户端脚本

var conn = new WebSocket('wss://website.com');

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...