先配置nginx
代码如下:
location ~ .*\.(php|php5)?$
{
if ($request_uri ~ "one/test") {
access_by_lua_file /opt/nginxrw/lua/limiturl.lua;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
然后就编写相应的lua脚本就可以了
要注意如果有特殊字符,则要加转义,如要拦截地址:firstsale/AjaxPanicNow
则要如下写
代码如下:
if ($request_uri ~ "firstsale\/AjaxPanicNow") {
rewrite_by_lua_file /opt/nginxrw/lua/limiturl.lua;
}