skip to Main Content

I have a stack Django+Gunicorn+nginx running in docker containers. It is accessible from outside by domain and Port, like web.example.com:1300 . Also, there is Nginx Proxy Manager (NPM) running (uses ports 80 and 443) and succesfully managing some other resources (for example nextcloud). But it doesn’t proxy to my django project at port 1300, shows "502 Bad Gateway".

In the Proxy Hosts of NPM I’ve added config:

domain names: web.example.com
Forward Hostname / IP: nginx_docker_container_name (this way it works with other resources)
Forward Port: 1300
Other settings: tried multiple combinations without success (like with and without SSL certificates etc.)

Is it possible to proxy using NPM?
Sorry if I missed to write some information, actually I do not know what else to state.

2

Answers


  1. Chosen as BEST ANSWER

    I managed to solve the problem myself.
    So, nginx in docker container serves web-site with static pages. Nginx proxy manager proxying htpp protocol to nginx and secures communication (and also works from docker container in my set-up).

    My mistake was that I didn't connect those docker containers by virtual network.
    Ones I put them into one network - everything works.
    Then I unpublished nginx port (1300).

    NPM proxy settings are "standard", e.g. no "custom location" and nothing in "Advanced" tab. Just "Forward Hostname / IP" is docker container tag and "Forward Port" is nginx port it listens to (80 by default).


  2. With WhiteNoise , you don’t need to configure nginx for django static files

    ❤️❤️❤️

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search