메뉴 닫기

apache에서 디렉토리 리스팅 차단하기

디렉토리 리스팅은 디렉토리에서 index 파일이 없을때, 해당 경로의 모든 파일가 디렉토리를 보여주는 것입니다.

이는 서버에 대한 정보가 입력되는 파일 등을 타인이 볼 수 있기 때문에, 보안상 위험할 수 있습니다.

 

디렉토리 리스팅 확인

먼저, 디렉토리 리스팅이 되고 있는지 확인합니다.

선택 영역_091

 

디렉토리 리스팅 차단 설정

httpd.conf 설정 파일을 엽니다.

# vi /usr/local/apache/conf/httpd.conf

 

httpd.conf 설정 중 디렉토리 경로 설정 부분에서 Options의 Indexes 설정을 제거하거나, -Indexes로 변경해줍니다.

<Directory “/usr/local/apache/htdocs”>
    #Options Indexes FollowSymLinks
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

or

<Directory “/usr/local/apache/htdocs”>
    #Options Indexes FollowSymLinks
    Options -Indexes FollowSymLinks

    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

 

변경을 완료했으면, apache를 재시작 해줍니다.

이제 index 파일이 없는 경로에 접속을 하면, 다음과 같이 출력되는 것을 확인 할 수 있습니다.

선택 영역_092

 

 

 

 

[polldaddy rating=”7739789″]

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x