月度存档: 7 月 2018

nginx proxy wss

微信小游戏要求上 wss。

使用netty的自有证书,测试可以,但是正式上线时,还得挂有CA认证的证书。

这里直接使用域名下的nginx通过433端口进行反向代理访问游戏服务器的wss。
注:如果后端服务器使用的是ws,则仅需要将以下https修改为http即可

    location /websocket {
        proxy_buffers 8 32k;
        proxy_buffer_size 64k;

        proxy_pass https://127.0.0.1:8000/websocket;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

Warning: Use of undefined constant XML - assumed 'XML' (this will throw an Error in a future version of PHP) in /opt/wordpress/wp-content/plugins/wp-syntaxhighlighter/wp-syntaxhighlighter.php on line 1048