nginx rewrite 正则表达式

【字号: 日期:2022-06-27浏览:50作者:雯心

问题描述

http://localhost/actionhttp://localhost/action/pre/xx/xx

所有action接口交给tomcat处理, 但为了能同时访问上面的两个URL, 我配置了下面两个location段, 总觉得这种配置方式不是很优雅, 请教大神有什么更好的方法, 不甚感激!

location ~ ^/(action)/?$ { proxy_pass http://tomcats;}location ~ ^/(action)/(.+)$ { proxy_pass http://tomcats;}

问题解答

回答1:

你好,请问一下

thinkPHP3.2留言板视频教程

原地址是什么,我想去研究一下。

回答2:

看你的需要求,直接

location ^~ /action/{ proxy_pass http://tomcats;}

应该就行了。

相关文章: