Skip to content

Fixing Ubuntu error “entity too large” in nginx, Django

I recently came across this bug while working through the alpha of HorseRecords. Image upload worked perfectly in development but in production it bailed out on all but very small images.

The solution was to adjust the nginx config variable client_max_body_size.

It defaults to 1 meg – so trying to upload an image bigger than that causes it to fail and pull a Ubuntu error “entity too large” error.

So try adding the client_max_body_size to something like 100M and then restart the server to have the new config option applied.

    ######################
    # HTTPS server
    ######################
    server {
        ...
        listen       443 default_server ssl;
        server_name  xxxx.net;
        client_max_body_size 100M;
        ...
    }

Leave a Reply