Error during WebSocket handshake: Unexpected response code: 404


直接訪問IP和端口是沒有問題,用了nginx之后產生了問題。

經查找,需要在nginx中設置(紅色部分)。

server {
         listen       80;
         server_name jsjnks.test.com;
         charset utf-8;
         location / {
             proxy_pass http://jsjnks;
             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_redirect  off; 
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
         }       
         location /public {
             alias  "D:/app/nginx/html/public";
         }   
         location /jsjnks-static {
             alias  "D:/app/nginx/html/jsjnks-static";
         }           
     }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM