How to enable a directory listing in Apache web server [closed]
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 thedirectory, then mod_autoindex can generate a listing of the directorycontents. This is turned on and off using theOptions
directive. Forexample, to turn on directory listings for a particular directory, youcan 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 inyour configuration file. Or to prevent them only for a singledirectory, 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.