I want to prevent phpmyadmin being accessible from the internet. I have two ethernet adapters on my CentOS 7 box, one 'internal' and one 'external'. I would like to restrict access so that users (any IP address) from the 'internal' network can access the phpmyadmin page and those connecting from the 'external' network (internet) cannot access the phpmyadmin page.

I have tried adding the below to my conf file and it did not make a difference.

Order Deny,Allow
Deny from All
Allow from

In /etc/httpd/conf/httpd.conf I have added the following at to the file:

Listen xxx.xxx.xxx.xxx:83 (xxx.xxx.xxx.xxx = the IP of the internal NIC)

ServerName phpmyadmin.server.local Alias /phpmyadmin /usr/share/phpMyAdmin/

And I've commented out the following in the /etc/httpd/conf.d/phpMyAdmin.conf file

Alias /phpMyAdmin /usr/share/phpMyAdmin

The only way I can get access to phpmyadmin is via http://xxx.xxx.xxx.xxx/phpmyadmin/index.php (port 80) and I have to have my IP address list as a '' address in phpMyAdmin.conf


You should configure Apache to listen on required IP-address(address of internal) in VirtualHost where your phpMyAdmin is working, it's better solution. After this configuration your phpMyAdmin would only accessible from internal network.

If your phpMyAdmin located in "main" VirtualHost, you could move it to separate file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.