Tag Archives: phpmyadmin

Apache2: prevent access to a specific directory

Edit the file /etc/apache2/sites-available/default (or any apache config file defining a directory):

Alias /doc/ "/usr/share/doc/"
<directory "/usr/share/doc/">
   Options Indexes MultiViews FollowSymLinks
   AllowOverride None
   Order deny,allow
   Deny from all
   Allow from 127.0.0.0/255.0.0.0 ::1/128
</directory>

The line Allow from … could also read something like:

   # allow only from local network
   Allow from 192.168

This is useful for things like phpmyadmin and other resources you don’t want to expose to the Internet. Don’t forget to restart apache after making changes to the apache conf:

# service apache restart
Posted in Linux | Tagged , , , | Leave a comment