Introduction
I checked few tutorials on how to run phpMyAdmin on different port but they were a bit confusing for me since I do not work with apache that much. So I decided to write a newbie one.
Why do I want to do this? Well it's in my humble opinion more secure then allowing anyone to access your phpMyAdmin from well know path and public port.
How to?
First you need to remove phpMyAdmin config file /etc/apache2/conf-available/phpmyadmin.conf
rm /etc/apache2/conf-available/phpmyadmin.conf
or Include directive in apache config file /etc/apache2/apache2.conf
Include /etc/phpmyadmin/apache.conf
Then You need to add new listening port to Your ports.conf file located in /etc/apache2/ports.conf
Listen 8030
and new vhost with phpMyAdmin secret path to Your ports.conf file as well
<VirtualHost *:8030>
Alias /SecretPathTophpMyAdmin /usr/share/phpmyadmin
</VirtualHost>
After You need to reload apache configuration by issuing following command
service apache2 reload
Now You can access your phpMyAdmin only on port 8030 with custom path
http://serverIP:8030/SecretPathTophpMyAdmin/
As You can see its not ppssible to access phpMyAdmin on port 80 with custom and default path nor on port 666 with default path (I used port 666 instead of port 8030 in my configuration)
But it is possible to access it on port 666 with custom path :)
Other articles that may be useful
http://stackoverflow.com/questions/3687940/how-to-restrict-access-to-phpmyadmin
http://stackoverflow.com/questions/2631269/how-to-secure-phpmyadmin
http://httpd.apache.org/docs/2.2/vhosts/examples.html
http://serverfault.com/questions/487335/allow-access-to-phpmyadmin-only-on-a-specified-virtualhost
History
- 07/29/2014 - First published.