2015-08-30

[debian] apache2 web server 간단한 설정

집에서 사용하는 개인용 Debian에서 apache2로 web server를 설정하는 방법을 기록한다.

1. 준비
Debian 설치시 옵션으로 web server를 사용하겠다고 선택했더니 이미 apache2가 설치되어 있었다. 방화벽도 열려 있었다.
기본 설정 파일 내용은 변경을 거의 안할것다. 일부 보안 관련 설정만 작업 할 것이다.

web root : /var/www/html (기본 설정)

2. security.conf 수정
# vi /etc/apache2/conf-available/security.conf

<Directory />
   AllowOverride None
   Order Deny,Allow
   Deny from all
</Directory>

<Directory /var/www/html>
   AllowOverride None
   Order Deny,Allow
   Allow from all
</Directory>

ServerTokens Prod
ServerSignature Off
TraceEnable On

3. user 추가
# htpasswd -c /etc/apache2/passwd userid

4. 디렉토리 설정
# vi /etc/apache2/conf-available/video.conf
<Directory /var/www/html/video>
   Order Deny,Allow
   AuthType Basic
   AuthName "testauthname"
   AuthUserFile /etc/apache2/passwd
   Require valid-user
</Directory>

5. 설정 파일 link
# ln -s /etc/apache2/conf-available/video.conf /etc/apache2/conf-enabled/video.conf

6. 재시작
# service apache2 restart

웹 브라우저에 video 디렉 토리 접근시 3번 과정에서 추가한 userid와 password를 요구한다.



댓글 없음:

댓글 쓰기