【发布时间】:2019-01-27 15:46:37
【问题描述】:
我正在尝试在我的服务器配置文件中为 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;
}
}
security-directives 文件包含第一个代码块中详述的指令。
【问题讨论】:
标签: nginx web server configuration backend