server {
listen 5080;
server_name www.example.com;
root /home/htdocs/app/;
index index.php;
location / {
try_files $uri $uri/ /index.php?s=$uri;
}
location ~ .*\.php$ {
# 白名单配置,只允许/index.php访问
if ($fastcgi_script_name !~* "^/(index)\.php$") {
return 403;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
}
PS:发现发错地方了,请移动至话题讨论区去,感谢!