I know this has been asked several times before but I just can't make it work in my config. I'm getting 413 error when trying to upload files larger than the default nginx value of client_max_body_size
with is 1 MB.
This are my configs:
nginx.conf:
http {
client_max_body_size 500M;
limit_req_status 429;
limit_conn_status 429;
limit_req_zone $binary_remote_addr zone=worktoday:40m rate=10r/s;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
mysite.com:
server {
client_max_body_size 500M;
listen 80;
location / {
client_max_body_size 500M;
proxy_pass http://backend;
proxy_set_header Host $host;
}
}
upstream backend {
client_max_body_size 500M;
least_conn;
server 172.16.10.10;
server 172.16.10.12;
}
I tried all combinations, putting client_max_body_size
in all places (like now), only in some, setting it to 0 (to disable any limit), etc.
I'm desperate to solve this.
Behind nginx there's a flask application running with gunicorn. I already tried the app by itself (without nginx in front) and it works.
I'll really appreciate any help here, thanks.