Limiting Access to a directory from apache based on IP Address

I figured I would post this, as it could be use full in the future. This is an example of how to limit access to a web enabled directory in apache by ip address. There are a number of great web based tools for linux, but it is important to lock them down. Add this to your apatche.conf file, or which ever config file you have already included with apache. For example I added this to the apache.conf file that phpmyadmin installs in “/etc/phpmyadmin/”

<Directory “/etc/phpmyadmin/”>
           AllowOverride All
            Order deny,allow 
            Deny from all  
            Allow from 127 
            Allow from 192.168.0.62 
            # office
            Allow from 64.220.17.205 
</Directory>
Advertisements