How to disable directory indexes Browsing in Server ?

Linux Dedicated Server allows you to host mulitple websites under your web hosting space. Linux Dedicated Server comes with full root access where you will be having control to make any changes at any time.

By default most web-servers like Apache have directory browsing enabled. It simply means that people can view the content of the individual folders (directories) in your website.

Directory listing is disabled by default in most servers for security purposes. You can disable/enable the directory listing option from the Apache configuration. You can improve the server security by disabling this feature globally.

Kindly follow the below procedure to Disable Indexes thru WHM.

  1. Login to WHM.
  2. Under “Service Configuration” choose “Apache configuration
  3. Navigate to Global Configuration.
  4. Untick Indexes option in “Directory ‘/’ Options”.

[ Indexes : Allow use of the directives controlling directory indexing]

  1. Click the Save button.
  2. It will show as “Rebuild Configuration and Restart Apache”, Click on it.
  3. Result will come as below,

Rebuilding Apache Configuration
Rebuilding httpd.conf …
Built /etc/apache2/conf/httpd.conf OK
Restarting Apache (hard) …
1
Done!

Thats it. Now Indexes option has been disabled thru WHM.

Kindly follow the below procedure to Disable Indexes thru SSH.

  1. Login to server via SSH (as a root)
  2. Go to Apache Configuration path [ /etc/apache2/conf]
  3. Open httpd.conf
  4. Search “Options

Options ExecCGI FollowSymLinks IncludesNOEXEC Indexes

Remove the word ‘Indexes ‘from options

Options ExecCGI FollowSymLinks IncludesNOEXEC

5. Restart Apache

service httpd restart

That’s all. Directory listing is disabled in the server.

Let us know if having any further clarification.