Secure VPS phpMyAdmin with maximum protection

Provided that you have phpMyAdmin installed on your VPS, you should secure it as much as you can to protect your databases. I use Centos on my VPS and these instructions are for Centos.

First of all, when you install phpMyAdmin on your VPS, you will have to configure your ip address into phpMyAdmin.conf that is located at /etc/httpd/conf.d/phpMyAdmin.conf. Simply do a Google search for “what’s my ip” and replace with your ip address.

Next, let’s secure the phpMyAdmin with .htaccess and .htpasswd. You can Google htpasswd generator and create your username and password. Copy the text that is generated into a text editor and save the file as .htpasswd.

Finally, create the .htaccess file. The .htaccess file will need to include the following:

AuthType Basic

AuthName "Restricted Files"

AuthUserFile /usr/share/phpMyAdmin/.htpasswd

Require valid-user

You can change “Restricted Files” to anything you like. Upload .htaccess and .htpasswd to /usr/share/phpMyAdmin.

Using ssh, enter the following commmand:

service httpd restart

That’s it. Now your phpMyAdmin is secured to work only from your ip. Even if someone is using your ip address, they still have to go through two passwords to get into your databases. This will protect you and your sites.



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.