Dino Geek, try to help you

How to configure mod_autoindex module in Apache?


The `mod_autoindex` module is used in Apache web server to list the contents of the directories that have no index (`index.html`, `index.php`, etc.). It’s used when you want to show the files and subdirectories of a particular directory in a webpage.

Here’s how to configure mod\_autoindex module in Apache:

1. Enable mod\_autoindex module: Depending on the Apache installation, the module might be available by default. If not, you would need to enable it. On Ubuntu/Debian, you can do so with the following command:

```
sudo a2enmod autoindex
```

On RedHat/CentOS, ensure the following line is un-commented in `httpd.conf`:

```
LoadModule autoindex_module modules/mod_autoindex.so
```

1. Basic Configuration: To enable automatic directory listing, you add `Options +Indexes` directive in the `Directory` tag:

```
Options +Indexes . .

```
1. Detailed Configuration: The `IndexOptions` directive is used for customizing the appearance of the file list. For example,

```
Options +Indexes IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8 . .

```

Here `FancyIndexing` is for fancy file listings, `VersionSort` is for sorting files containing version numbers, `NameWidth=*` is for dynamically sizing column width, `HTMLTable` is for using HTML tables for the layout, `Charset=UTF-8` is for setting charset.

1. Header and Readme Files: If you want custom Header and Footer (readme) for your directory listings, you can do it with `HeaderName` and `ReadmeName` directives like:

```
Options +Indexes IndexOptions FancyIndexing HeaderName /header.html ReadmeName /footer.html . .

```

1. Excluding Files: `IndexIgnore` directive specifies files to hide in the listing:

```
Options +Indexes IndexIgnore *.zip *.gz *.tar . .

```

1. After making changes, don’t forget to restart the Apache server:

```
sudo systemctl restart apache2 ## Ubuntu/Debian

sudo systemctl restart httpd ## RedHat/CentOS
```

Remember that if Apache is not configured safely, directory listing can lead to revealing sensitive information. Always be careful to only list directories that you want users to see.

Ensure you have the required permissions to make these changes and always backup your configuration files before making any alterations.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use