Restrict phpMyAdmin access to only internal private IP address
I managed to configure my phpmyadmin to only allow access from within my network only (the private IP address range) e.g. 192.168.1.XXX.
This is important to ensure the security of your database, I just do not want people to guest all the password by entering into the phpmyadmin setting.
To do so, copy the following code to config.inc.php in the phpmyadmin folder:
//block root from logging in except from the private networks
$cfg['Servers'][$i]['AllowDeny']['order'] = 'deny,allow';
$cfg['Servers'][$i]['AllowDeny']['rules'] = array(
'deny root from all',
'allow root from localhost',
'allow root from 192.168.1.0/24',
The “0/24” denotes wildcat (equivalent to * in Windows)
After that chmod 705 the file
Then restart your lightpd server using the following command:
sh /ffp/start/lighttpd.sh restart
now your phpmyadmin can only be accessed from your LAN network only.
17 Comments »