AntDesign通过Nginx访问后端API的配置参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
server { server_name www.test.com;#域名 root G:/dist; #文件夹路径 location / { # 用于配合 browserHistory使用 try_files $uri $uri/ /index.html; # 如果有资源,建议使用 https + http2,配合按需加载可以获得更好的体验 # rewrite ^/(.*)$ https://preview.pro.ant.design/$1 permanent; } location /api { #反向代理 如果请求的使api就代理到 修改为自己api的域名 proxy_pass https://preview.pro.ant.design; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; } } |
如若转载,请注明出处:https://www.gavindong.com/2752.html