自学内容网 自学内容网

Nginx 配置代理

Nginx 配置 ws 代理




 # WebSocket代理
 location /wsUrl/ {
      rewrite ^/wsUrl/(.*)$ /$1 break; 
      proxy_pass http://192.168.1.100:9890; #这里是http不是ws,不用怀疑,代理的ip和port写ws访问的实际地址
      proxy_http_version 1.1;    
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";
    }

http 代理

  location ^~ /apis/ {
          proxy_set_header X-Forward-For $remote_addr;
          proxy_set_header X-real-ip $remote_addr;
          proxy_pass http://10.10.9.5:9002/;
        }

定位index.html

location / {   
        try_files $uri $uri/ /index.html;
     } 

vue 代理只能解决开发环境 不能解决部署环境,所以需要用nginx代理


原文地址:https://blog.csdn.net/z_robot/article/details/154232324

免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!