Not strictly an answer to this specific question but as this question came up while I was having a very similar issue I'll post it here in case it helps somebody else.
The problem I was having was pretty much the same as the OP, (any upload larger than 128mb was bombing out in Chrome) but I was using Plesk on my UB 16.04 server (nginx proxy HTTP/2) so any attempts to directly change the nginx settings were failing as Plesk overwrites them.
By default the Plesk panel applies a client_max_body_size 128m;
to every nginx conf file although the default nginx setting is 1mb. This causes problems as no matter what you set with PHP nginx bombs out as soon as an upload hits anything over about 25mb. I'm not sure why that figure was important, maybe that's when nginx reads the headers for the next chunk of data? It see's that the incoming file is over 128mb and then bombs out throwing the ERR_CONNECTION_CLOSED
error in Chrome. I'm not really sure, all I know is that it was a mess.
There is an option to add directives for nginx in Plesk that is supposed to allow you to override this but it throws "duplicate entry" errors if you try to add anything :
Invalid nginx configuration: nginx: [emerg] "client_max_body_size" directive is duplicate in /var/www/vhosts/system/example.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed
I spent ages trying to find a fix and then found this article on Plesk's support forum which actually does the job.
Just a few simple steps (all detailed in the article) via the terminal to get it working, but just in case that ever vanishes into the ether...
Connect to the server with ssh.
Run the following command in order to add 'client_max_body_size 128m;' to the configuration of nginx:
echo 'client_max_body_size 128m;' > /etc/nginx/conf.d/aa_client_max_body.conf
As a result, 128m will be the default value of 'client_max_body_size' directive server-wide. Any other value can be set here.
Add the following lines to the /usr/local/psa/admin/conf/panel.ini:
[webserver]
nginxClientMaxBodySize =
If the panel.ini file does not exist, create it using sample file:
cp /usr/local/psa/admin/conf/panel.ini.sample /usr/local/psa/admin/conf/panel.ini
Make sure that permissions of the file /usr/local/psa/admin/conf/panel.ini are correct, otherwise the workaround will not work:
ls -la /usr/local/psa/admin/conf/panel.ini
-rw-r--r-- 1 root root 1857 Nov 26 11:03 /usr/local/psa/admin/conf/panel.ini
Regenerate NGINX\Apache configuration files for all vhosts to apply changes in /usr/local/psa/admin/conf/panel.ini:
plesk sbin httpdmng --reconfigure-all
As a result, there will not be 'client_max_body_size' directive defined in vhosts' configuration files.
Restart NGINX:
service nginx restart
Now it is possible to specify custom value of client_max_body_size in Domains > example.com > Apache & Nginx settings > Additional nginx directives per domain, i.e:
client_max_body_size 512m;
This works 100%. Full credit to Bulat Tsydenov (the author of this solution).
Saved my bacon :)
withCredentials: true
– Saipan