Plesk

Uploading of big file on websites hosted in Plesk fail: client intended to send too large body

Symptoms

Cause

Webserver limits maximum filesize to be uploaded.

Resolution

Note: The following solution increases the limit server wide.

  1. Log in to Plesk

  2. Adjust the following settings of PHP handler assigned to the domain in Tools & Settings > PHP Settings > X.X.XX FPM application in php.ini tab:

    post_max_size 2000m
    upload_max_filesize 2000m

  3. Perform the following steps depending on the webserver serving PHP in Domains > example.com > PHP Settings:

    For case PHP is served by nginx

    1. Connect to the server via SSH.

    2. Add the following directives to /usr/local/psa/admin/conf/panel.ini file using 'vi' utility to customize Plesk defaults:

      [webserver]
      nginxClientMaxBodySize = 2000m

      Note: If file /usr/local/psa/admin/conf/panel.ini does not exist, create it from the sample file with this command:

      # cp /usr/local/psa/admin/conf/panel.ini.sample /usr/local/psa/admin/conf/panel.ini

    3. Rebuild web server configuration files:

      # plesk repair web -domains-only

    4. Reload nginx:

      # service nginx reload

    For case PHP is served by Apache

    1. Connect to the server via SSH.

    2. Backup the main Apache configuration file:

      • On RedHat/CentOS/CloudLinux operating systems:

        # cp /etc/httpd/conf/httpd.conf{,.orig}

      • On Debian/Ubuntu operating systems:

        # cp /etc/apache2/apache2.conf{,.orig}

    3. Open the file from step 1. and add or modify the parameter LimitRequestBody to the required value in bytes, for example:

      LimitRequestBody 2147483647

      Note: The maximum value of the parameter LimitRequestBody is 2147483647 (2 gigabytes).

    4. Log in to Plesk.

    5. Go to Domains > example.com > Hosting & DNS > Apache & nginx Settings and set Maximum allowed HTTP request body size to desired value, e.g. 2GB.

    6. Click OK/Apply.