I followed the example: How to upload multiple files with django rest api? The solution work in localhost, but when i upload to nginx server running in a container docker, the nginx return a error 400, i can't more details because i'm not getting log, my nginx configuration it is like this:
upstream api {
server neworleansenglishcourse.com.br:8000;
}
server {
listen 80;
server_name neworleansenglishcourse.com.br www.neworleansenglishcourse.com.br;
location / {
client_max_body_size 8000M;
client_body_buffer_size 8000M;
client_body_timeout 120;
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api/ {
client_max_body_size 8000M;
client_body_buffer_size 8000M;
client_body_timeout 120;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://api;
}
location /complementos/ {
client_max_body_size 8000M;
client_body_buffer_size 8000M;
client_body_timeout 120;
}
}
My docker compose it is like this:
version: '3'
services:
backend:
build:
context: ./api
command: gunicorn plataformaingles.wsgi --bind 0.0.0.0:8000
ports:
- "8000:8000"
depends_on:
- db
networks:
- production-network
frontend:
build:
context: ./front
volumes:
- front_build:/front/build
networks:
- production-network
nginx:
image: nginx:latest
ports:
- "80:80"
volumes:
- ./nginx/nginx-setup.conf:/etc/nginx/conf.d/default.conf
- front_build:/usr/share/nginx/html
depends_on:
- backend
- frontend
networks:
- production-network
volumes:
front_build:
networks:
production-network:
driver: bridge