hakimdotdev / apache-directory-listing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configuring Apache for Directory Listing with .htaccess Authentication

Prerequisites

  • Apache web server installed and running (this guide is assuming a ubuntu/debian setup).

Configuration of the Server

  1. Open /etc/apache/sites-enabled/000-default.confin a text editor.
  2. Locate the section for the desired directory where you want to enable directory listing or set one up like this (Assuming the document root and directory for the listing is at /srv/data:
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /srv/data
        <Directory /srv/data>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
  1. Change the Document Root within the configuration file, if needed.

  2. You may need to activate the rewrite module with the following command sudo a2enmod rewrite

  3. Restart Apache systemctl restart apache2

  4. You also may want to add some theme, Abba has some really fancy options. Otherwise you can provide an own styling .htaccess like this:

  • TO-DO: Include custom .htaccess

About