'Authentication'에 해당되는 글 1건

  1. 2011.01.20 아파치 서버(Apache)의 특정 폴더에 암호 걸기.
웹서버를 운영할때 특정 폴더는 사용자 계정을 입력하여 접근하도록 해야할 경우가 있습니다. 이때 아파치 서버를 설정하는 방법입니다.

1. .htaccess 혹은 httpd.conf 화일의 <Directory> Section에 다음 라인을 추가합니다.

AllowOverride AuthConfig

2. 아래의 커멘드를 실행하여 암호 화일을 생성하고 http로 접근이 불가능한 폴더에 넣습니다.

htpasswd -c /usr/local/apache/passwd/passwords username
New password: mypassword
Re-type new password: mypassword
Adding password for user 
username

3. 원하는 폴더의 위치에 .htaccess 화일을 만들고 아래의 내용을 넣습니다.

AuthType Basic
AuthName "Restricted Files"
# (Following line optional)
AuthBasicProvider file
AuthUserFile /usr/local/apache/passwd/passwords
Require user 
username

4. 서버를 재실행합니다.
Posted by leeyongwan
,