0
웹 서버에서 apc.php 파일을 차단하려고합니다. 다음 작업을 수행하는 경우이 작업을 수행하고 부정/허용 규칙을 일반 위치 ~ .php $ 블록 아래에 두는 더 좋은 방법이 있다고 생각합니다. fastcgi 매개 변수가있는 블록이 두 개 있어야합니다. if 문에, 당신은 location/{ location /uri/ {} }
처럼 중첩 된 위치를 사용할 수 있습니다 허용되지 않습니다 "거부"이후nginx에서 apc.php 파일을 차단하십시오.
#Block to apc.php
location ~ /apc.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
allow 192.168.3.0/24;
deny all;
}
# use fastcgi for all php files
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;
}