In our previous article we discussed How To Install Linux, Apache, MySQL, PHP (LAMP) stack On CentOS 7. So, Securing your Apache web server is one of the most important task, specially when you setting up a new website. You can also see our previous posts for securing Apache by How to Disable Server Signature in Apache server.
If our website document directory does not have an index file(index.php/index.html), that time the Apache web server will show all the files and folder of the document root directory.
This is how Directory Listing will be shown to your visitors when index.html not present in it..
Disable Directory Listing in Apache
The best way to do Disable Directory Listing and securing Apache by ‘options directive’ available in the Apache configuration file.
Edit Apache virtual host file.
[[email protected] ~]# vim /etc/httpd/conf/httpd.conf ## for centos/redhat [[email protected] ~]# vim /etc/apache2/apache2.conf ## for ubuntu/debian
Add following line into virtual host file
[[email protected] ~]# service httpd restart ## for centos/redhat [[email protected] ~]# systemctl restart apache2 ## for ubuntu/debian
Now Apache shows /index of look like this:
The post Disable Directory Listing in Apache – Apache Security appeared first on DevOps Techie.
This post first appeared on Devops Techie - Solutios For Devops Tools And Practices, please read the originial post: here