我希望 Nginx 拒绝访问特定的 PHP 文件,我们称之为它donotexposeme.php
,但它似乎不起作用,PHP 脚本照常运行。这是我在配置文件中的内容:
location / {
root /var/www/public_html;
index index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/public_html$fastcgi_script_name;
include fastcgi_params;
}
location /donotexposeme.php {
deny all;
}
当然,我每次编辑配置时都会这样做sudo service nginx reload
(或)。restart