I would like to know how to prevent directory listings in Apache2 on debian7. For example, I am able to view the contents of a folder called “test.php” that created inside /var/www. I don’t want visitors to be able to view the contents of directories.
For the apache2.conf file , I have changed the
<Directory “/var/www”> Options Indexes FollowSymLinks IndexOptions FancyIndexing FoldersFirst IgnoreCase VersionSort NameWidth=* </Directory>
into
<Directory “/var/www”> Options FollowSymLinks </Directory>
and set <Directory /var/www/test> Options -Indexes </Directory>
It is no use to restart my apache2 ,the test.php file in the /var/www still be viewed by others when to input my vps_ip in firefox .
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
it’s worked for me thank you there is more option to do same thing using .htaccess file
you need to add the line:-
Options -Indexes
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.