Nginx reverse proxy error 413 on large file uploads


Set up a Nextcloud session at our office to start and get away from Google. Unfortunately we don’t have public ip addresses and the one from the ISP is dynamic so we decided to use Nginx reverse proxy servers installed on Digital Ocean and just tunnel out the necessary ports we need access to. Attached a very quick and simple drawing of how this works:

Everything works great, the only problem we discovered recently is large file uploads. It seems that this is not a shortcoming I can’t get around and keep getting error 413.

For the record on the LAN Nextcloud is running with Apache, no issue whatsoever, only when I use through the proxies.

My Apache conf:

No issues are appearing in the access or error logs, only the browser reports error 413.
Any help or guidance would be much appreciated!

P.S: Will add the rest of the configs, can’t post more than 2 links… And Yes I did research, spent 3 days on this already, can’t seem to figure it out. My last reference is from here:

The rest of the configs:

My Nextcloud.conf:
My optimize.conf:

My Nginx.conf:

Somebody? Anybody?
Anyhow, I will continue pursuing this issue tomorrow morning, will follow up on thos topic here.

In case you have any suggestions please feel free to share ::slight_smile:

Ok… so a looooong time gone, had to move the office, holidays etc. but figured quite a while ago and updated the above posted config files from pastebin accordingly.

As the nginx manual suggests the context of the client_max_body_size module is http, server, location and I originally had it only in the main nginx.conf. So yea, jokes on me. Hope this can help someone in the future.

I have the same problem on nexcloud 14, I still haven’t found a solution, I’m working on it.

My architecture is a dedicated server on ubuntu 18.04 with a apache2 is a nginx in reverse proxy. However, I looked in all the server configuration files is also the .htaccess everything seems well configured.

I followed what the documentation says to disable the check:

if you find a solution or a way:-), respectfully, Léo Fr

Thanks for help :grinning:

What fixed for me is to make sure that client_max_body_size 0 is present in both my nginx.conf (under the http section) and nextcloud,conf (under the server section).
I updated my .conf files accordingly on pastebin so that could give an idea.

You just helped me. Thanks greatly.

Inserting thr above code (note the semicolon!) into the server { location { section worked for me!

Many thanks,


Thank you !!!