Search code examples
phpapachenginxplesk

Increase upload size on Nginx


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.


Solution

  • 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.