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:

How to fix the Nginx 404 not found error when WordPress is not installed in the root directory

Sometimes you need to install and access WordPress in a subdirectory instead of the root directory (where your main site is served with Nginx).

If you get the Nginx 404 not found error when accessing WordPress, add the following code in the virtual host file (eg: /etc/nginx/sites-available/mysite) to solve the problem.

NOTE: Replace yoursubdirectory with the name of the subdirectory where WordPress is installed.