我有一个简单的nginx设置,事情工作正常。
我已经把索引设置如下:
index index.html index.php
server_name设置为local.nginx。 如果我请求http://local.nginx它工作正常,但如果我请求http://local.nginx/index.php – 原始文件发送到浏览器。
哪里不对?
请参阅下面的configuration:
server { listen 80; server_name local.nginx; root /var/www/local.nginx/; index index.html index.php; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
编辑
我发现这只是发生在铬。 清除浏览器caching后,问题消失。 任何人都可以解释发生了什么?
如果在testing的时候,你的PHPconfiguration不起作用,Chrome会caching原始的.php文件并继续提供。
请注意您的PHPconfiguration,特别是如果您将接受上传或保存对文档根目录中的文件的任何input,因为可以将path信息添加到url并让PHP解释器执行它,例如
HTTP://local.nginx/uploads/myfile.txt/oops.php