0

I have a uwsgi (python flask app) running in a Docker exposed port 8080.

I have an nginx running in another Docker ports 80 and 443.

Here is a snippet from my config

upstream backend {
    server my-uwsgi:8080;
}

server {
    server_name api.my.app my.app;

    listen 80;
    listen [::]:80;

    return 301 https://$host$request_uri;
}

server {
    server_name api.my.app my.app;

...

    location = /demo1/byAddress
    {
        include uwsgi_params;
        uwsgi_param X-Real-IP  $remote_addr;
        uwsgi_param X-Forwarded-For $remote_addr;
        uwsgi_param Host $host;
        uwsgi_pass backend;
    }

This does stand up, but is non functional.

In the nginx docker I can do telnet my-uwsgi:8080 so I know it can connect to the uwsgi Docker.

But in /var/log/nginx/error.log This is the first entry:

2022/01/10 00:04:49 [emerg] 9#9: host not found in upstream "my-uwsgi:8080" in `/etc/nginx/conf.d/my.conf:10`

I cannot figure out a combination that works, what is the magic that I am missing here?

Thanx

Bodger
  • 1,342
  • 4
  • 16
  • 23
  • Does this answer your question? [Docker Networking - nginx: \[emerg\] host not found in upstream](https://stackoverflow.com/questions/33639138/docker-networking-nginx-emerg-host-not-found-in-upstream) – Nick ODell Jan 10 '22 at 00:25
  • Two routes you could try: first, if you're using docker-compose, you can use `depends_on`, so that nginx starts after your uwsgi server has started. Second, you could try adjusting the `max_fails` or `fail_timeout` parameter for nginx upstream. Both approaches are described in the linked answer. – Nick ODell Jan 10 '22 at 00:26
  • Well I am not using docker compose. And the other server is up and running before I start nginx, so there is some other problem. Thank you though. – Bodger Jan 10 '22 at 00:52

0 Answers0