Installing phpMyAdmin securely on Centos, RedHat or Fedora

1. Make sure that you can access your server securely

https://yourserver.com

If you cannot access your server securely, let’s go and setup SSL on your server.

Again, I assume you are using a REDHAT based distribution.

  • Find if OpenSSL is running: “openssl version”
  • If OpenSSL is not running just install it with Yum : “yum install openssl”

Install a certificate by following the instructions in the following website:

(I wanted to write an article about SSL but this websites does a good job)

http://www.akadia.com/services/ssh_test_certificate.html

Your website should now be secure then it is time to install phpMyAdmin.


2. Unzip your phpMyAdmin to your virtual directory

Then browse to the virtual directory.

http://yourserver.com/phpmyadmin or wherever you put it.

Use the setup script to help you set up the config file;

http://yourserver.com/phpmyadmin/setup

Personally I do not like the setup script; I like to edit the config file manually.

When you done with the setup script, make sure you delete the “SETUP” folder.


3. We might also want to create a .htaccess file to force the db administrators to always access

phpMyAdmin securely.

Here is the content of the .htaccess files:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

4. Voila.


References:

http://www.phpmyadmin.net/documentation/Documentation.html#setup_script

http://www.akadia.com/services/ssh_test_certificate.html

http://www.cyberciti.biz/tips/howto-apache-force-https-secure-connections.html