진짜 개발자
본문 바로가기

Cloud 교육

5주-1일차 (httpd)

728x90

보안 - 보안상의 이유로 절대로 관리자 계정으로 실행을 못하게 되어있다

 - 




설정파일

/etc/httpd/conf/httpd.conf 


ServerTokens  - 보안과 관련되어 OS로 냅둘경우 디렉토리 기능활성화시 http의 버전정보 및 정보들을 볼 수 있어

      취약점이 쉽게 파악된다

             - 46번째 줄을 Prod 로 바꾸어 감춘다


MaxKeepAliveRequest - 하나의 사용자가 요청하는 페이지를 제한


port  -프로세스의 포트를 설정

 - 136 번째 줄


LoadModule - 필요할 때만 사용된다



ExtendedStatus - 서버의 정보를 보여준다


Document Root와 <Directory></Directory>는 짝으로 구성 : 각각 문서가위치한 디렉토리 위치와 , 접근 설정


<Directory> </Directory> - 310 째줄

- 전역설정

- 페이지 전체에 영향을 미치는 설정 

- 특정한 페이지에 설정이 되어있지 않으면 이설정을 따른다



<Directory> - 317 ~ 346


Options followsmlinks -디렉토리 리스닝 기능 

- url 을 입력했을때 

 - 331째 줄을 지우면 된다

- 보안상 권장 안함


Access Control(ACL)  -342 ~ 344 번째 줄

- 순차적으로 적용됨

- 마지막에는 묵시적으로 deny all 이 적용됨

- 따라서 맨첫줄에 모든 것을 allow 하거나 , deny 하면 됨

- 341에 Order allow, deny  역순서대로 적용이 되게 되어있음(deny, allow)

ex) Order deny,allow

Allow from 1.0.0.253

Deny from all


 

일 때 가 allow위에 있더라도 deny가 순서이므로 deny all 이 먼저 적용됨


서버의 성능(921번ㅉㅐ 줄)

도메인/server-status 를 하면 아파치 서버의 상태가 나옴

이자료를 가지고 서버의 성능그래프를 만들 수 있다


서버 정보 (933번째 줄)




/etc/http/conf/httpd.conf vi 편집시 오류가 나타날 때


(1) Another program may be editing the same file.  If this is the

 case,

    be careful not to end up with two different instances of the

same

    file when making changes.  Quit, or continue with caution.

(2) An edit session for this file crashed.

    If this is the case, use ":recover" or "vim -r /etc/httpd/con

f/httpd.conf"

    to recover the changes (see ":help recovery").

    If you did this already, delete the swap file "/etc/httpd/con

f/.httpd.conf.swp"

    to avoid this message.


/etc/httpd/conf/.httpd.conf.swp 파일을 지워야한다


*하나의 서버가 여러개의 도메인을 가지고 있고, 각각의 도메인마다 다른 서비스를 하고 싶을때 993번째 줄의 NameVirtualHost 의 주석을 제거해야한다.



접근제어(Access Control(ACL)  -342 ~ 344 번째 줄)

설정파일(/etc/httpd/conf/httpd.conf) 에서 <Directory></Directory> 안에 AllowOverride all을 추가


htpasswd -c 인증키위치(/www/.auth

처음 만들때만 -c

두번째 만들때도 사용하면 덮어 씌임


인증파일 만들기

인증할 디렉토리로 이동하여 .htaccess 를 만들고 아래의 내용을 기입

AuthName "Apache Auth Proccess"

AuthType Basic

AuthUserFile /www/.auth

Require user a b