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

Extract files

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

Install PostgreSQL module for PHP

sudo apt-get install php5-pgsql

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.

sudo su - postgres
createuser --superuser --pwprompt adminusername

Enter the password for superuser.

Configure phpPgAdmin

Open the file phppgadmin/conf/ (example: /var/www/yoursite/phppgadmin/conf/

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

$conf['servers'][0]['host'] = 'localhost';

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.

$conf['extra_login_security'] = false; 

Nginx virtual host

If your site is already served with Nginx, just access

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:

server {

    index  index.html index.htm index.php;

    root /var/www/yoursite/phppgadmin;

    access_log off;

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;