扫码关注官方订阅号
location ~ ^/pages/\d+_index.json{ proxy_pass /pages/index.json; }
试了一下不行我对nginx配置不太熟悉,请教了.
欢迎选择我的课程,让我们一起见证您的进步~~
你可以使用 rewrite 重写你的请求路径
location / { rewrite ^/pages/\d+_index\.json /pages/index.json break; proxy_pass http://127.0.0.1:8080; } # 测试下 会返回重写后的 url /pages/index.json location = /pages/index.json { return 200 $request_uri; }
我找到了两种解决的方法rewrite:
location ~ ^/pages/{ rewrite ^/pages/(\d+)/\d+_index.json http://$host/pages/$1/index.json break; }
proxy_pass
location ~ ^/pages/(\d+)/\d+_index.json$ { proxy_pass http://$host/pages/$1/index.json; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
你可以使用 rewrite 重写你的请求路径
我找到了两种解决的方法
rewrite:
proxy_pass