2010-11-30 4 views
0

어떻게 Nginx에서 단일 ph PHP 스크립트를 암호로 보호 할 수 있습니까? 나는 웹 서버로 nginx를 사용하고 있으며, PHP-fastcgi로 프록시를 사용하고있다. 예상대로 동작하도록 위치 블록을 가져올 수 없습니다.Nginx - 암호 보호 PHP 스크립트

다음은 내가 시도하고있는 것을 보여줍니다.

location /admin\.php$ { 
    auth_basic "Valid User Required"; 
    auth_basic_user_file /etc/nginx/http-auth; 
} 
location ~\.php$ { 
    root /var/www/nginx/vhosts/site; 
    include /etc/nginx/fastcgi_params; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
    fastcgi_pass phpfcgi; 
} 

답변

0
location /admin\.php$ { 
    auth_basic "Valid User Required"; 
    auth_basic_user_file /etc/nginx/http-auth; 
+ root /var/www/nginx/vhosts/site; 
+ include /etc/nginx/fastcgi_params; 
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
+ fastcgi_pass phpfcgi; 
}

이 당신에게 도움이 될 수 있습니다.