nginx 配置如下
这个是 nginx 配置文件
location ~ \.php$ {
access_by_lua_file /etc/nginx/conf.d/lua/bitian.lua;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
lua 文件如下
local uri = ngx.var.request_uri
if uri == "/test" then
return ngx.redirect("www.test.com")
end
访问 /test 接口直接 502