Click here to Skip to main content
15,888,000 members
Articles / Security
Tip/Trick

Running phpMyAdmin on different port

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
29 Jul 2014CPOL1 min read 43.9K   1  
Securing Your phpMyAdmin

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

C++
Listen 8030

and new vhost with phpMyAdmin secret path to Your ports.conf file as well

C++
<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)

Image 1

Image 2

 

But it is possible to access it on port 666 with custom path :)

Image 3

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Systems / Hardware Administrator Cro-bit Ltd.
Croatia Croatia
I'm a PC Technician by profession, currently studying computing at Univeristy of Split, FESB
If you wish to contact me you may do so by LinkedIn on http://www.linkedin.com/in/marincokaric/

Comments and Discussions

 
-- There are no messages in this forum --