<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                >[info] 配置wss的目的是因為現在大多數服務都是基于https請求,ws連接socket是基于http的,如果服務是https,ws是不能連接到socket的,需要依賴wss才行,這就是本章節需要講的內容。 # 一、參考網站 nginx官網文檔:[http://nginx.org/en/docs/http/websocket.html](http://nginx.org/en/docs/http/websocket.html)。 ![](https://img.kancloud.cn/b7/51/b751f50216df8878f55f20f97083242c_816x561.png) # 二、寶塔里面的配置 1、配置文件添加內容: ![](https://img.kancloud.cn/46/28/4628219ea45346ab7c8f9b98eefd4419_704x355.png) 代碼如下: ``` map $http_upgrade $connection_upgrade { default upgrade; '' close; } # 這里的backend可以改成自己需要的名稱,我自己用的是wss。 upstream wss { # 這里的localhost是映射本地服務器,也可以是外網ip,2345是我ws開啟的端口。 server localhost:1234; } ``` 2、偽靜態添加: ![](https://img.kancloud.cn/93/a9/93a960403aa373c3d95eb1ea75cf5aa4_677x243.png) 代碼如下: ``` # 注意:這里的/wss后面沒有/了哦 location /wss { proxy_pass http://wss; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } ``` 現在前端就可以通過“wss://你的服務器域名/wss”來創建websocket鏈接了。 3、前端創建websocket鏈接(對應的域名也要安裝證書) ![](https://img.kancloud.cn/e2/a7/e2a77409496e5aaf0df334be9b0d9e37_495x140.png) ![](https://img.kancloud.cn/16/07/1607d1161c4c4df6c8391acfe136bcaf_1093x432.png) 到此,寶塔nginx配置wss就算完成了,當然前提是后端站點配置了ssl證書哈 >[]好文轉載,此章節轉載地址:[寶塔Nginx配置wss](https://blog.csdn.net/zouxiaohu2020/article/details/108197640) -(原作者如有要求,會立馬下架此章節)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看