Skip to content

geek3000/Directory_Listing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

How can we prevent Directory Listing vulnerability in a web server

To prevent Directory Listing vulnerability in a web server we should edit the configuration files of the web server.

Depending of the web server we can do this:

.htaccess file

Create a .htaccess file in the related directory (on web site) and put this line:

Options -Indexes

For apache web server,

Add this line in httpd.conf files,

<Directory /var/www/public_html>
      Options -Indexes
</Directory>

For Nginx Server,

Edit the configuration file nginx.conf, it can be found at /usr/local/nginx/conf, /etc/nginx or /usr/local/etc/nginx

Modified, it would be something like:

server {
	listen   80;
	server_name  domain.com www.domain.com;
	access_log  /var/...........................;
        root   /path/to/root;
        location / {
                index  index.php index.html index.htm;
        }
        location /somedir {
               autoindex off;
        }
}

The value off autoindex must be off

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages