2012-09-30 2 views
0

내 로컬 호스트에 암호로 보호 된 디렉토리를 설정하려고합니다..htpasswd 로그인 화면에 문제가 없습니다.

AuthType Basic 
AuthName Restricted 
AuthUserFile /home/adarshakb/.htpasswd 
require valid-user 

을하고 .htpasswd에는 다음이 포함됩니다 :

.htaccess 파일이 /var/www/project/code/server/development에 위치하고 있으며 .htpasswd 파일이 /home/adarshakb/.htpasswd

htaccess로 파일에 있습니다은 포함

user:HkCKfIOQNlS1E 

을 지금 , 내가 간다면 http://localhost/project/code/server/development/ 그것은 나에게 묻지 않는다. 또는 어떤 인증이라도 열면됩니다.

무엇이 잘못 되었나요?

+0

을 /etc/apache2/apache2.conf 파일은 어떻게 구성되어 있습니까? 재정의가 허용되는지, 즉 .htaccess 파일 사용을 허용합니까? http://httpd.apache.org/docs/2.2/howto/htaccess.html –

+0

@MortenHaraldsen 예. 허용됩니다. 그것에는 다음과 같은 줄이 있습니다. 'AccessFileName .htaccess' – footy

+0

그리고 보호하려는 디렉토리에 AllowOverride None이 없습니까? –

답변

0

일부 모듈이 부족합니다. 이것을 보장하려면 .htaccess 파일에 쓰레기를 넣어보고 무슨 일이 일어나는지 말해주십시오. 오류 500 인 경우 모듈이 제대로로드됩니다.

이 명령으로로드 된 모듈을 인쇄 할 수 있습니다

apache2ctl -M 2>/dev/null 

당신이 필요로하는 최소한 mod_authn_file & mod_auth_basic

+0

POST가 모듈 요구 사항으로 편집 됨 –

+0

다음 항목이 있습니다. auth_basic_module (shared) authn_file_module (shared) – footy

0

합니까에서 htaccess로의 라인을 변경 :

AuthName Restricted 

AuthName "Password Protected Area" 

작품? 그 후

, htaccess로 대체 가능 :

sudo nano /etc/apache2/sites-available/default 

변경 "에 AllowOverride 없음"을 "에 AllowOverride 모두"에서 :

<Directory /var/www/> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride None 
     Order allow,deny 
     allow from all 
</Directory> 

마지막으로 설정을 다시로드 :

sudo /etc/init.d/apache2 reload 
관련 문제