我正在尝试在我的服务器配置文件中为nginx设置安全指令。我有以下指示:
location /config {
deny all;
return 404;
}
该目录中的所有文件都受到限制,但PHP文件不受该指令的影响,我的目的是拒绝所有内容。我假设配置文件中的另一个指令正在覆盖这个指令,但是我在nginx中还是个新手。
这是服务器的完整配置代码:
server{
listen 80;
server_name mydomain.com;
root myrootpath;
index index.php index.html index.htm;
include security-directives;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
}
}
安全指令文件包含第一个代码块中详细说明的指令。