Disable directory browsing in Apache httpd.conf


How to disable directory browsing in Apache httpd.conf in CentOS Fedora Linux Ubuntu Redhat Apache2

Disable Apache directory browsing

In the latest Apache Fedora Servers, edit the httpd.conf and remove the Indexes form the default document root access.

#vim /etc/httpc/conf/httpd.conf

# Further relax access to the default document root:
<Directory “/var/www/html”>
# Possible values for the Options directive are “None”, “All”,
# or any combination of:
#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that “MultiViews” must be named *explicitly* — “Options All”
# doesn’t give it to you.
#
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be “All”, “None”, or any combination of the keywords:
#   Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>

In the Old Apache servers add “-” in the Indexes
Options -Indexes FollowSymLinks
 

Save the settings and restart the Apache Service

#systemctl restart httpd.service