Issue uploading large files to Synology behind a nginx reverse proxy with SSL

We had a issue uploading larger files (100mb>) to our Synology NAS.
After looking in the acces logs on the reverse proxy i found the next errors.

a client request body is buffered to a temporary file /var/lib/nginx/body/0000000002

And

*1 client intended to send too large body: 50203334 bytes

To Fix this i edited the nginx.conf and the proxy_params. I changed the limit of files to 5GB / 5120MB.

I added the next rule to the nginx.conf

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
client_max_body_size 5120M;
include /etc/nginx/mime.types;
default_type application/octet-stream

 

 

And the proxy_params changed to:

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 5120m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

 

 

Close Menu