Hosting pgAdmin4 behind nginx and at /pgdmin, for mortals - Mailing list pgadmin-support

From Shaheed Haque
Subject Hosting pgAdmin4 behind nginx and at /pgdmin, for mortals
Date
Msg-id CAHAc2jfjd7TxAyOAxzHLVuTm_K-s9WWNPZSrehSFaQB77BQYuw@mail.gmail.com
Whole thread Raw
Responses Re: Hosting pgAdmin4 behind nginx and at /pgdmin, for mortals  (Shaheed Haque <srhaque@theiet.org>)
List pgadmin-support
Hi,

I'm a relative noob when it comes to the world of nginx, wsgi and so forth, but I do have several other things working (a Django app under gunicorn and the RabbitMQ web UI directly behind nginx). However, I'm rather stuck getting pgAdmin4 to run at http://mydomain.com:80/pgadmin behind nginx. Is there a simple, up-to-date example of how to do this (I'm running the latest, v4.2, of pgAdmin4)?

I'm aware of threads such as https://www.postgresql.org/message-id/2197768425D7F5479A0FFB3FEC212F7FF602B871%40aesmail.surcouf.local, and several others but not been able to come up with a clear approach:

One of the several variables I'm struggling to understand is the choice of whether to run pgAdmin4.py on port 5050 directly behind nginx, or as a WSGI app under gunicorn. I assume the latter should be easier to set up, but I've tried both (modelled on what I have working, and various references). One combination I tried was:

- Creating a softlink from pgadmin4.py to pgAdmin4.wsgi
- Using gunicorn to run the pgadmin4.py to a unix domain socket like this:

    $ /usr/local/bin/gunicorn -w 1 --bind unix:/home/ubuntu/pgadmin.sock pgadmin4:application

- Serving behind nginx like this:

    location /pgadmin {
        rewrite ^/pgadmin/(.*) /$1 break;
        include proxy_params;
        proxy_pass http://unix:/home/ubuntu/pgadmin.sock;
    }

But all I get is a stubborn 404. Any pointers welcome...

Thanks, Shaheed

P.S. I considered just making pgAdmin4.py listen on 0.0.0.0:5050, but I do need to get everything behind HTTPS sooner rather than later.







pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: [pgadmin4] Make.bat with python3.6
Next
From: Raphaël Martin
Date:
Subject: Bug report : update / delete impossible when primary key contain %