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";
         }           
     }

猜你喜欢

转载自www.cnblogs.com/huiy/p/13382812.html