본문 바로가기

리눅스

[리눅스] 아파치 웹 서버에서 디렉토리 리스팅을 막기

반응형

아파치 웹 서버에서 디렉토리 리스팅을 막기

1. 아파치 웹 서버에서 디렉토리 리스팅을 막으려면 Options 지시어에서 Indexes 옵션을 제거하면 됩니다.

2. Apache 설정 파일(httpd.conf)을 열어서 디렉토리 설정 부분을 찾습니다.

해당 디렉토리 설정에 대한 Options 지시어를 찾습니다. 일반적으로 아래와 같은 형태로 되어 있습니다.

<Directory "/var/www/html">
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

3. Options 지시어에서 Indexes 옵션을 제거합니다.

<Directory "/var/www/html">
   Options FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

4. 변경 사항을 저장하고 Apache를 재시작합니다.

sudo service apache2 restart

이제 해당 디렉토리에 대한 디렉토리 리스팅이 비활성화되었습니다. 디렉토리 내부의 파일에는 여전히 접근할 수 있지만, 디렉토리 자체를 열어볼 때는 빈 페이지가 표시됩니다.


아파치 디렉토리 리스팅 막기

<VirtualHost *:80>
    serverAdmin [email protected]
    ServerName cdms.sangchul.kr
    ServerAlias tcdms.sangchul.kr
    DocumentRoot "/user/www/cdms_80/htdocs"
    ErrorLog "/logs/httpd/cdms.sangchul.kr-error_log"
    CustomLog "/logs/httpd/cdms.sangchul.kr-access_log" common
    <Directory "/user/www/cdms_80/htdocs">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec => Indexes 제거
        <Limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        </Limit>
        <LimitExcept GET POST OPTIONS>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>
</VirtualHost>

 

728x90
반응형

'리눅스' 카테고리의 다른 글

[vnc] vnc-server 설정  (0) 2013.06.18
[PHP] PHP Credits 페이지 통제  (0) 2013.06.18
[Apache] 아파치 버전정보 노출 막기  (0) 2013.06.18
[MySQL] mysql max_allowed_packet 설정  (1) 2013.06.18
zip 명령어, unzip 명령어  (0) 2013.06.18