免费资源网 – https://freexyz.cn/
1、转发路径以端口结尾不添加根路径的情况
请求:
http://127.0.0.1/appStore/api/getTest以下全部基于此请求进行映射说明,红色为推荐配置
配置1:
只替换到端口的那一部分
location ^~ /appStore { proxy_pass http://127.0.0.1:9222; }实际:
http://127.0.0.1:9222/appStore/api/getTest配置2:
location ^~ /appStore/ { proxy_pass http://127.0.0.1:9222; }实际:
http://127.0.0.1:9222/appStore/api/getTest配置3:
替换到标识的路径部分
location ^~ /appStore { proxy_pass http://127.0.0.1:9222/; }实际:
http://127.0.0.1:9222//api/getTest配置4:
location ^~ /appStore/ { proxy_pass http://127.0.0.1:9222/; }实际:
http://127.0.0.1:9222/api/getTest2、转发路径以端口结尾添加根路径的情况
请求:
http://127.0.0.1/appStore/api/getTest配置1:
替换到标识的路径部分
location ^~ /appStore { proxy_pass http://127.0.0.1:9222/appStore; }实际:
http://127.0.0.1:9222/appStore/api/getTest配置2:
location ^~ /appStore/ { proxy_pass http://127.0.0.1:9222/appStore; }实际:
http://127.0.0.1:9222/appStoreapi/getTest配置3:
location ^~ /appStore { proxy_pass http://127.0.0.1:9222/appStore/; }实际:
http://127.0.0.1:9222/appStore//api/getTest配置4:
location ^~ /appStore/ { proxy_pass http://127.0.0.1:9222/appStore/; }实际:
http://127.0.0.1:9222/appStore/api/getTest总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持。
© 版权声明
THE END
暂无评论内容