How to install phpPgAdmin to work with Nginx (without Apache)

This tutorial is intended for those who want to install and configure phpPgAdmin manually so it can work with Nginx, without needing Apache. I created this tutorial using Ubuntu server 14.04.

Download phpPgAdmin

Download one of the compressed files at http://phppgadmin.sourceforge.net.

Extract files

Extract the compressed file to the folder you want to serve phpPgAdmin (example: /var/www/yoursite/phppgadmin)

Install PostgreSQL module for PHP

Create PostgreSQL superuser to use in phpPgAdmin

Choose a username for your superuser. Here I used (adminusername) and you can replace it for another username you prefer.

Enter the password for superuser.

Configure phpPgAdmin

Open the file phppgadmin/conf/config.inc.php (example: /var/www/yoursite/phppgadmin/conf/config.inc.php)

If Postgres and phpPgAdmin is installed in the same server, change the line:

Search the file for extra_login_security. If extra_login_security = true, login attempts on phpPgAdmin with no password or certain usernames (pgsql, postgres, root, administrator) will be denied (you will get the “Login disallowed for security reasons.” error). So, set extra_login_security to false if it is your case.

Nginx virtual host

If your site is already served with Nginx, just access http://yoursite.com/phppgadmin

But If you want to access phpPgAdmin from another URL like a subdomain for example, a Nginx virtual host file for phpPgAdmin is needed.

This is just a sample of a Nginx virtual host file: