I am not able to enable directory listing in my Apache web server. I have tried various solutions posted, but it is not working. I just freshly installed httpd 2.4.6 and enabled HTTPS using ssl.conf under the /etc/httpd/conf.d/ssl.conf directory and trying to access https://server.example.com/, but this is not listing the directory. These are the configuration in file ssl.conf:
DocumentRoot "/home/userx/Downloads/"
ServerName server.example.com:443
Below is what it has in ssl.conf under the VirtualHost element. Files and the first Directory elements were already there when I installed, and I just added Directory for "/home/userx/Downloads". I want to browse the contents of /home/userx/Downloads when I access the URL https://server.example.com/. What am I missing here?
<Files ~ "\.(cgi|shtml|phtml|php3?)$">
SSLOptions +StdEnvVars
</Files>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
<Directory "/home/userx/Downloads">
Options +Indexes
AllowOverride all
</Directory>
Under the "Actions" pane verify "Directory Browsing" is "Disabled". If "Directory Browsing" is not "Disabled", this is a finding. Follow the procedures below for each site hosted on the IIS 8.5 web server: Open the IIS 8.5 Manager.
See if you are able to access/list the '/icons/' directory. This is useful to test the behavior of "Directory" in Apache.
For example: You might be having the below configuration by default in your httpd.conf file. So hit the URL IP:Port/icons/ and see if it lists the icons or not. You can also try by putting the 'directory/folder' inside the 'var/www/icons'.
Alias /icons/ "/var/www/icons/"
<Directory "/var/www/icons">
Options Indexes MultiViews
AllowOverride None
Require all granted
</Directory>
If it does work, then you can cross-check or modify your custom directory configuration with the '<Directory "/var/www/icons">' configuration.
According to the Apache documentation, found here, the DirectoryIndex
directive needs to be specified in the site .conf
file (typically found in /etc/apache2/sites-available
on Linux).
Quoting from the documentation, it reads:
If no file from the
DirectoryIndex
directive can be located in the directory, then mod_autoindex can generate a listing of the directory contents. This is turned on and off using theOptions
directive. For example, to turn on directory listings for a particular directory, you can use:<Directory /usr/local/apache2/htdocs/listme> Options +Indexes </Directory>
To prevent directory listings (for security purposes, for example), you should remove the Indexes keyword from every Options directive in your configuration file. Or to prevent them only for a single directory, you can use:
<Directory /usr/local/apache2/htdocs/dontlistme> Options -Indexes </Directory>
Try this.
<Directory "/home/userx/Downloads">
Options +Indexes
AllowOverride all
Order allow,deny
Allow from all
Require all granted
</Directory>
If that doesn't work, you probably have 'deny indexes' somewhere that's overriding your config.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With