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代理

相关推荐
子兮曰19 小时前
OpenClaw入门:从零开始搭建你的私有化AI助手
前端·架构·github
吴仰晖19 小时前
使用github copliot chat的源码学习之Chromium Compositor
前端
1024小神19 小时前
github发布pages的几种状态记录
前端
不像程序员的程序媛21 小时前
Nginx日志切分
服务器·前端·nginx
北原_春希1 天前
如何在Vue3项目中引入并使用Echarts图表
前端·javascript·echarts
尽意啊1 天前
echarts树图动态添加子节点
前端·javascript·echarts
吃面必吃蒜1 天前
echarts 极坐标柱状图 如何定义柱子颜色
前端·javascript·echarts
O_oStayPositive1 天前
Vue3使用ECharts
前端·javascript·echarts
竹秋…1 天前
echarts自定义tooltip中的内容
前端·javascript·echarts
宝贝露.1 天前
Axure引入Echarts图无法正常显示问题
前端·javascript·echarts