Increase upload size on Nginx

2019-07-25 17:48发布

问题:

I keep getting "The connection was reset" when trying to upload a large file (around 135MB). When I look at the "last_nginx.conf" of the website conf directory it says "client_max_body_size 128m;" I assume that is the upload limit, so how/where do I change it? It says not to bother changing the value in that file because it will only be overwritten. Btw Nginx is enabled via Plesk admin panel.

回答1:

Answer to change vhosts nginx file is this :

mkdir /usr/local/psa/admin/conf/templates/custom/domain

cp /usr/local/psa/admin/conf/templates/default/domain/nginxDomainVirtualHost.php /usr/local/psa/admin/conf/templates/custom/domain/

add in /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php:

<?php if (file_exists($VAR->domain->physicalHosting->vhostDir . '/conf/nginx.conf')): ?>
include <?php echo $VAR->domain->physicalHosting->vhostDir;?>/conf/nginx.conf;
<?php endif ?>

/usr/local/psa/admin/bin/httpdmng --reconfigure-all # to apply new configuration for all domains

As result, if domain has conf/nginx.conf - it will be included into virtual host config.



回答2:

client_max_body_size does not limit the size of an upload. The upload must be set by the server administrator in the .ini file or you may be able to modify the value within a .htaccess file; read this.