올바르게 작동하는 설정이있는 서버 (nginx/1.6.0 PHP 5.5.14)가 있습니다. location ^~ /sys/
sys 폴더에 액세스하려고하면 색인이 다운로드됩니다. location ^~/sys /
을 정상적으로 작동하도록 제거하면. 그는 PHP 파일에서만 오류가 발생합니다. html 파일은 정상적으로 작동합니다. 오류는 어디에 있습니까?Nginx 파일을 다운로드 중
server {
server_name site.com;
root /home/www/site.com;
index index.php index.html index.htm;
location/{
index index.php index.html;
try_files $uri $uri/ /index.php;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/data/php5514/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 300;
include fastcgi_params;
}
location ^~ /sys/ {
}
}
나는 스크립트를 사용하고 있으며 무단 액세스로부터 폴더를 보호하기 위해이 설정을 nginx에서 수행해야합니다.
location ^~ /FOLDER/ {
if ($cookie_amember_nr !~* [a-zA-Z0-9]+) { #not authorized
rewrite ^(.*)$ http://EXAMPLE.COM/AMEMBER/protect/new-rewrite?f=FOLDERID&url=$request_uri?$args redirect;
}
set $file $document_root/AMEMBER/data/new-rewrite/$cookie_amember_nr-FOLDERID;
if (!-f $file) { #have not access
rewrite ^(.*)$ http://EXAMPLE.COM/AMEMBER/no-access/folder/id/FOLDERID?url=$request_uri?$args redirect;
}
#everything is ok
}
그러나 location^~
의 경우이 문제는 해결되지 않습니다.
전문적인 서버 또는 네트워킹 관련 인프라 관리 **에 대한 질문은 프로그래밍 또는 프로그래밍 도구와 직접 관련되지 않는 한 스택 오버플로에 대해 논쟁의 여지가 없습니다. [Server Fault] (http://serverfault.com/about)에서 도움을받을 수 있습니다. – icecub