1 Replies - 166 Views - Last Post: 18 June 2019 - 09:44 AM

#1 Petro Gromovo   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 14-February 19

How to install postgresql and phppgadmin with nginx?

Posted 18 June 2019 - 01:00 AM


I need to install postgresql and phppgadmin with nginx installed under ubuntu 16(AWS)
I installed packages :
$ sudo apt-get -y install postgresql postgresql-contrib phppgadmin
Reading package lists... Done
Building dependency tree       
Reading state information... Done
phppgadmin is already the newest version (5.1+ds-1ubuntu1).
postgresql is already the newest version (9.5+173ubuntu0.2).
postgresql-contrib is already the newest version (9.5+173ubuntu0.2).
0 upgraded, 0 newly installed, 0 to remove and 15 not upgraded.

in phpinfo I see drivers installed
PostgreSQL driver for PDO	Edin Kadribasic, Ilia Alshanetsky
PostgreSQL	Jouni Ahto, Zeev Suraski, Yasuo Ohgaki, Chris Kings-Lynne

But running phppgadmin in url like :
I got error :
404 Not Found
nginx/1.10.3 (Ubuntu)

Searching for decision I found that /etc/nginx/sites-available/phppgadmin directory, but :
$ cd /etc/nginx/sites-available
[email protected]:/etc/nginx/sites-available$ ls -la
total 16
drwxr-xr-x 2 root root 4096 Jun 18 05:15 .
drwxr-xr-x 6 root root 4096 Jun 12 15:46 ..
-rw-r--r-- 1 root root 2327 Jun 17 12:02 default
-rw-r--r-- 1 root root 2074 Jun 12 15:49 default.bak

Which steps I have to take to run phppgadmin and laravel 5 app ?


Is This A Good Question/Topic? 0
  • +

Replies To: How to install postgresql and phppgadmin with nginx?

#2 Radius Nightly   User is offline

  • D.I.C Regular

Reputation: 39
  • View blog
  • Posts: 321
  • Joined: 07-May 15

Re: How to install postgresql and phppgadmin with nginx?

Posted 18 June 2019 - 09:44 AM

Maybe i wont help you much, but i will try to make it simple. I pull out some configs from my friends old site. It was using Nginx, FastCGI and MySQL. Even if you use different PHP or database, same rules apply.

You need this three applications to run independently, they are not connected, each one of that programs are independent, so its fine to avoid 3in1 packages or something like that, only configurations are connecting them. Nginx are used as the base to run static content, FastCGI (or something else) for PHP content, MySQL (or something else, like PostgreSQL) for database, something else for FTP, etc. I IPs and connections are set up.

In Nginx main config you wanna block access outside the site folder (so no one can walk outside the site folder) and include folder location where site config are located.
Example: https://www.hastebin...nidabajap.nginx

In included folder location where site config are, define location of the site content, and set up connections to the CGI application/service (in this example FastCGI) to be used when there are dynamic content or when Nginx cant run it (Nginx will do static), so Nginx can send commands trough connection in valid form to the CGI who will process dynamic content and database if needed, and return results to Nginx. It also require a location of the site content.
Example: https://www.hastebin...amuwonaha.nginx

Now set up your FastCGI service (or something similar that will process PHP) and config for your site. Enable extension for database you use, so it knows how to use a specific database, for PostgreSQL its pgsql, as well as set up the connection to your database service (on which database are listening), so CGI can connect to the database and use it correctly. Your drivers are extensions that can be enabled or disabled, and this extensions are libraries thats located inside CGI folder, like php/ext/.
Example: https://www.hastebin.../negafaxiju.php

Finally, set up your database and match connection on which database will listen for commands from CGI, so they can communicate.
Example: https://www.hastebin...hoyutunav.mysql

If done correctly, everything should work, static content (html, txt, mp3, avi, zip, etc.), dynamic content (php) and database.
BTW Make sure when one of this processes are using specific IP and/or port for itself, thats not already used by something else.

This post has been edited by Radius Nightly: 18 June 2019 - 09:53 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1