How to disable directory listing to /icons/ directory or /icons/README default content |
I’ve recently configured a new server running Debian Lenny Linux. It really irritated methat by default an Alias existed to the /icons/ directory.
It took me a while to get through the configured Virtualhosts in /etc/apache2/sites-enabled/ , the /etc/apache2/apache2.conf and check among the enabled Apache modueles existing in /etc/apache2/mods-avaiable/
I finally got that the Alias to the directory was because of a configuration directives in /etc/apache2/mods-available/alias.conf
To disable the Alias you’ll have to:
debian-server:~# nano /etc/apache2/mods-available/alias.conf
Then Change in the /etc/apache2/mods-available/alias.conf :
<Directory "/usr/share/apache2/icons">Allow from all to Deny from all in order to forbid access to the /icons/ directory.
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
If you want to completely wipe out the Alias comment out the line:
Alias /icons/ "/usr/share/apache2/icons/"
Now restart Apache and the access to the /icons/ directory enabled by default on Debian would be no more
debian-server:~# /etc/init.d/apache2 restart
If your OS is "Centos" and web server is httpd :
The listing results from an alias of the apache /icons/ folder - I "fixed" it by editing your httpd.conf file so it now contains.
Open file configuration httpd.conf :
debian-server:~# nano /etc/httpd/conf/httpd.conf
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
# New stuff #
Alias /icons/ /user/www/icons/
Options -Indexes +MultiViews
AllowOverride None
Order allow,deny
Allow from all
#end of new stuff
and restart your httpd
debian-server:~# /etc/init.d/apache2 restart
Result :
Solved |
Source
How to disable directory listing to /icons/ directory or /icons/README default content
Reviewed by Sitakom Blog
on
7:35 PM
Rating:
No comments: