http://5.101.99.123/info.php
是可以工作的,但是如果我进入主页 http://5.101.99.123
,它会下载我的index.php:/ 有什么建议吗?-rw-r--r-- 1 agitar_user www-data 418 Jul 31 18:27 index.php
-rw-r--r-- 1 agitar_user www-data 21 Aug 31 11:20 info.php
My /etc/nginx/sites-available/default
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/html;
index index.html index.htm index.php;
# Make site accessible from http://localhost/
server_name agitarycompartir.com;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location / {
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
...
Other "locations" are commented on...
.
location some-regex-here {
开始。 正则表达式和标志指定服务器如何处理匹配的资源。 你在问题中展示的PHP位置块指示Nginx应用这些规则来处理每个匹配的请求/资源。 听起来PHP没有遵循这些规则。 假设文件被加载了,另一个位置块在PHP块之前捕获了PHP文件是有道理的。(顺便说一句,测试文件是否被加载的快速方法是制造语法错误并重新启动服务器。) - Brad