1
와 하위 디렉토리,하지만 내가 여기 이상한 문제를 ecountered 한 재
# For whole site
location/{
auth_basic "Restricted";
auth_basic_user_file /home/john/.htpasswd;
}
# Forum rewrite
location /forum/ {
try_files $uri $uri/ @forum;
}
location @forum {
rewrite ^/forum/(.+)$ /forum/index.php?p=$1 last;
}
보호가 전체 사이트에 대해 잘 작동 제의 nginx의 conf 파일이지만,
https://mysite.com/forum/
https://mysite.com/forum/discussion/9/help-support
및 암호를 입력하지 않고 직접 액세스 할 수 있었다 : URL이있는 경우 "위치"명령으로 정의 된이 특정 포럼 폴더에 대해 작동하지 않습니다. 그러나 이상하게도 후행 슬래시 없이도 작동합니다.
https://mysite.com/forum
사용자 이름과 암호를 묻습니다. 다음과 같은 포럼 위치에 auth_basic 보호 명령을 반복하십시오.
location /forum/ {
auth_basic "Restricted";
auth_basic_user_file /home/john/.htpasswd;
try_files $uri $uri/ @forum;
}
도 도움이되지 않았습니다. 모든 단서? 고맙습니다! 당신은 전체 사이트에 대한 활성 auth_basic 원하기 때문에