vue一个前端但是后端接口多个,在nginx中配置:
server { listen 10001; server_name share_pingtai; location / { root /home/kfy/pingtai; index index.html index.htm; } location @router { rewrite ^.*$ /index.html last; } location ^~/sys/ { proxy_set_header Host $host; proxy_set_header x-forwarded-for $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://IP:10000/; #实际的接口地址 } location ^~/api/ { proxy_set_header Host $host; proxy_set_header x-forwarded-for $remote_addr; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://IP:10000/; #实际的接口地址 } }
标签:index,set,header,网站,IP,接口,nginx,proxy,location From: https://www.cnblogs.com/ckfuture/p/16813448.html