Archive for the 'linux' Category

Page 2 of 40

deny access to phpmyadmin via ip — apache

want to protect your phpmy­ad­min dir­ect­ory from unau­thor­ised access? i do. tried the usual .htac­cess tricks but couldn’t get them to work… don’t know if it was to do with /var/www/phpmyadmin being a sym­bolic link of /usr/share/phpmyadmin or some­thing else. i’m using debian but your setup should be similar if you’re using apache 2.

i wanted only com­puters on my local network to be able to login (or if i connect remotely using an ssh tunnel) so one solu­tion is to add the fol­low­ing to the end of /etc/apache2/apache2.conf (remem­ber to back up your ori­ginal apache2.conf before you start tinkering)

#deny access to phpmy­ad­min
<Dir­ect­ory /var/www/phpmyadmin>
        Order Deny,Allow
        Deny from all
        Allow from 10.0.0.1/24
</Directory>

you’ll need to the reload apache using

/etc/init.d/apache2 reload

if you wanted to add another IP address or domain insert another Allow line like this

#deny access to phpmy­ad­min
<Dir­ect­ory /var/www/phpmyadmin>
        Order Deny,Allow
        Deny from all
        Allow from 10.0.0.1/24
        Allow from .yourdomain.com
        Allow from 102.51.333.65
</Directory>

and reload apache again.

 

Post to Twitter


Bear