Table of Contents
Verified and Tested 01/31/2015
Introduction
This document will help you install phpMyAdmin and describe some basic steps to take in order to secure it.
Prerequisites
You need an Ubuntu 14.04 server that is configured with a static IP address.
You will also need to have LAMP (Linux, Apache, MySQL and PHP) installed on the server.
Installing phpMyAdmin
Install phpMyAdmin
sudo apt-get install phpmyadmin
phpMyAdmin is now installed on your server. Now we begin the Apache configuration.
Setup phpMyAdmin under Apache, edit the apache2.conf file.
sudo nano /etc/apache2/apache2.conf
Add the following code to the bottom of the apache2.conf file.
Include /etc/phpmyadmin/apache.conf
Save your changes by pressing Ctrl + X then Y to accept.
Restart Apache.
sudo service apache2 restart
Verify that your installation works, type the following link in your browser http://YOURIP/myphpadmin
(Log in with the username and password that was created during the installation)
Securing myPHPAdmin
Setup security for phpMyAdmin, edit the apache.conf file:
sudo nano /etc/phpmyadmin/apache.conf
Locate the <Directory /usr/share/phpmyadmin> and add the following rule under DirectoryIndex index.php
AllowOverride All
Save your changes by pressing Ctrl + X then Y to accept.
Create the .htaccess file that will handle the authentication.
sudo nano /usr/share/phpmyadmin/.htaccess
Paste the following text in the file:
AuthType Basic AuthName "Restricted Files" AuthUserFile /etc/apache2/.phpmyadmin.htpasswd Require valid-user
Save your changes by pressing Ctrl + X then Y to accept.
Create a user and password that you would like to use for security access by pasting the following code. Then you will enter and re enter your password. (Note:Replace username with the actual user that you want to create. I will be using admin).
sudo htpasswd -c /etc/apache2/.phpmyadmin.htpasswd username
Restart Apache.
sudo service apache2 restart
Verify that everything works by typing the following link in your browser http://YOURIP/myphpadmin and typing your security username and password
Congratulations! You have just installed and secured phpMyAdmin on your server. Thank you for following along in this How-To and feel free to check back with us for any new updates.
Atlantic.Net
Since 1995, Atlantic.Net has been providing internet services to customers, including managed, cloud, and vps hosting. In 20+ years of service, our solutions have been focused on providing the very best in web solutions to our valued customers!