IT용어위키



Apache Options Indexes

The Options Indexes directive in Apache HTTP Server configures the display of directory listings. When enabled, this option allows users to see a list of files in a directory if no default file (like `index.html` or `index.php`) is present. This can be useful for browsing available files, but it also presents security considerations, as it can expose sensitive information.

Purpose of Options Indexes

The Options Indexes directive controls whether Apache will display a directory listing when no default file is found:

  • If enabled, Apache generates a directory listing, allowing users to browse files.
  • If disabled, Apache returns a "403 Forbidden" error, restricting directory browsing access.

How to Enable or Disable Directory Indexing

The Options Indexes directive can be set at different levels (server-wide, virtual host, or directory level) within the Apache configuration file, typically `httpd.conf` or `apache2.conf`.

Enabling Directory Indexing

To enable directory listing for a specific directory, add the following configuration:

<Directory "/path/to/directory">
   Options +Indexes
</Directory>

This command enables directory listing only for the specified directory.

Disabling Directory Indexing

To disable directory indexing globally or for a specific directory, use the following:

<Directory "/path/to/directory">
   Options -Indexes
</Directory>

This command prevents directory listings, returning a "403 Forbidden" error when users attempt to access a directory without a default file.

Security Considerations

While directory indexing can be convenient, it poses security risks, as it may expose sensitive files to unauthorized users. Best practices include:

  • Restricting Indexing to Specific Directories: Enable indexing only for directories where file browsing is necessary.
  • Using .htaccess to Control Indexing: Configure directory indexing within `.htaccess` files to allow more granular control.
  • Securing Sensitive Files: Ensure that sensitive files (e.g., configuration or backup files) are either hidden or stored outside of publicly accessible directories.

Related Concepts


  출처: IT위키(IT위키에서 최신 문서 보기)
  * 본 페이지는 공대위키에서 미러링된 페이지입니다. 일부 오류나 표현의 누락이 있을 수 있습니다. 원본 문서는 공대위키에서 확인하세요!