Adding phpMyAdmin to the Nginx web server is very like adding a sub-site. Dead easy! The process takes 10 minutes, tops.
This guide shows you how to add the client, configure a virtual host file with its symlink, and create a simple A record.
Create an A or AAAA Record
If we do this first, by the time everything else is done the new DNS record should have propagated and we'll be ready to play.
Go to your web host's DNS manager and create an A record, adding the following:-
|Hostname||IP||TTL (Time to Live)|
|phpmyadmin.mydomain.com||the IP you use for mydomain.com||shortest option|
Tidy tip: For a little added security, rather than phpmyadmin.mydomain.com, choose something like hackoff.mydomain.com.
You can exit your DNS manager. It'll take a little while for the new setting to register. At my VPS Linode, it's minutes not hours. Yours? Dunno, but probably no longer than an hour or two.
Install the phpMyAdmin Software
Logged into your remote command line interface, type:-
.. and when asked for confirmation, type ‘y' and hit Return.
A blue screen pops up asking which web server to reconfigure. Press the spacebar to choose ‘Apache2', then tab onto ‘OK', pressing Enter.
But I'm using Nginx, not Apache?
Sure, valid point.
phpMyAdmin downloads Apache2 as a dependent file, if you don't already have it installed. Truth is, I have no idea why and maybe someone out there can put me right. But hey, while it'll take up a little space it won't be wasting resources, ‘cos we won't be using it.
When configuring PMA and it asks for a web server, all I know is that by choosing Apache2 and concluding the install, Apache will fail to start (because Nginx is using the port it wants) and you'll never hear from Apache again. Sweet.
Besides, with my method, phpMyAdmin just works!
But, hey, if anyone can fill me in with some more detail about all this, that'd be grand, and I'll improve this guide if possible.
So that's PMA installed. Now to configure it.
Configure the phpMyAdmin Virtual Host (vhost) File
This configures PMA to work with Nginx. Let's change directory, to where all our vhosts live:-
And open a new file, which we'll call “phpmyadmin”:-
And paste this lot, swapping the three incidences of mydomain.com for your_domain.tld:-
NB If you're using my anti-hack tip mentioned above, then change the line ..
.. to read something like ..
Create an Nginx Symlink for phpMyAdmin
Paste this into your terminal:-
And, finally, restart Nginx ..
.. Or, if you followed Edit bashrc for User-Friendly Linux, plus System Updates, just type:-
Go Mine Data
Connect to your database using:-
.. or, if you went the anti-hack route ..
Login and enjoy.