0

I have an app (blog) made with Python and Django. Using docker-compose I've managed to deploy it to a Digital Ocean droplet.

The Docker stack includes a Postgres db nginx, nginx-proxy and the nginx-acme companion for SSL. The app works fine in production.

Then I wanted to add an app for tracking usage, called Umami, with its Postgres DB. I've managed to add it to the same docker-compose stack. Both apps seem to be working, but nginx now fails (sometimes) to serve the static content.

I assume that this has to be related to the setting of nginx, so I'm sharing my setting in order to get some guidance.

Checking the logs of nginx and nginx-proxy with docker logs couldn't get any relevant data about what is wrong.

upstream my_app{
    server django:8000;
}

server {
    listen 80;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://my_app;
   }

    location /static/ {
        autoindex off;
        alias /home/app/web/staticfiles/;
    }

    location /media/ {
        autoindex off;
        alias /home/app/web/media/;
    }
}


server {
  listen 80;
  server_name umami.mypersonalserver.online;

  location / {
    proxy_pass http://localhost:3000;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

Would you guys give me any hints?

0 Answers0