下面你看到我的服务器部分工作得很好,但现在我必须"模拟"一个不存在的php文件。
location ~ \.php$
{
fastcgi_pass php;
include fastcgi.conf;
}
try_files $uri $uri/ /index.php?$uri&$args;
我的所有网址目前都是在try_files设置下重写为我的index.php,但如果我尝试访问domain.tld / something.php则不会。
如何让这些位置阻止domain.tld/something**.php**
使用我的try_files
并将其发送到index.php
?
提前致谢。
答案 0 :(得分:1)
对我来说很好。希望这对你也有用。
location ~\.php$ {
index index.php index.html;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
try_files /index.php /index.php;
}