Apache 웹서버에서 디렉토리 리스팅 제거하기:
- Indexes 옵션 사용 여부 확인
sudo vi /etc/httpd/conf/httpd.conf
또는/etc/apache2/apache2.conf
- Options 지시문을 찾아 Indexes 옵션을 제거 또는 비활성화
원래 설정:
Options Indexes FollowSymLinks
변경 후 설정:
Options -Indexes FollowSymLinks
- Apache 서버를 재시작하여 변경 사항을 적용
sudo systemctl restart httpd
Nginx 웹서버에서 디렉토리 리스팅 제거하기:
/etc/nginx/nginx.conf
또는/etc/nginx/sites-available/default
- autoindex 지시문을 찾아 off로 설정
autoindex off;
- 만약 해당 지시문이 없다면, 필요한 위치에 추가
/etc/nginx/nginx.conf
파일 내
- Nginx 서버를 재시작하여 변경 사항을 적용
sudo systemctl restart nginx
이러한 설정 변경을 통해 웹서버에서 디렉토리 리스팅 기능을 비활성화하여 보안을 강화합니다.