Invalid nginx configuration: nginx: [emerg] "client_max_body_size" directive is duplicate


2016-11-16 12:49:06 UTC


2017-08-18 07:30:39 UTC


Was this article helpful?

Have more questions?

Submit a request

Invalid nginx configuration: nginx: [emerg] "client_max_body_size" directive is duplicate

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux


The following error is being displayed during an attempt to set a directive client_max_body_size in the Additional nginx directives in domain web server settings:

Invalid nginx configuration: nginx: [emerg] "client_max_body_size" directive is duplicate in /var/www/vhosts/system/ nginx: configuration file /etc/nginx/nginx.conf test failed


This is Plesk bug with ID #PPPM-1914 . The issue will be fixed in future updates.


The following workaround can be applied:

  1. Add the following lines to the /usr/local/psa/admin/conf/panel.ini :

    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 

    By default, client_max_body_size 128m; is added to all vhosts. If the value is specified in panel.ini (e.g. "nginxClientMaxBodySize = 64m") default client_max_body_size value will be overridden server-wide.

  2. Reconfigure NGINX\Apache settings to apply changes in /usr/local/psa/admin/conf/panel.ini :

    # plesk sbin httpdmng --reconfigure-all
  3. Restart NGINX:

    # service nginx restart
  4. Now it is possible to specify custom value of client_max_body_size in Additional nginx directives per domain, i.e:

    client_max_body_size 512m

All domains that do not have the custom value for this directive, will get a default one from /usr/local/psa/admin/conf/panel.ini .

Have more questions? Submit a request


  • 1

    Please edit documentation to say "edit or create panel.ini file".

    I avoided creating this file because when I seen it doesn't exist I thought this is an old solution. 


  • 1
    Nikolay Zhmuk

    Hi, thank you for the comment. The article has been updated.

  • 0
    Tony Collins

    This does not work. This workaround does not set the correct variable for the correct template. A Plesk expert responded to someone discussing this workaround in another thread by saying "it's the setting for the Plesk Panel server (sw-cp-server), not the server that the domains are hosted on Apache or Nginx". In other words, the advice given here does not do anything for the problem we are facing, because it deals with the PLESK PANEL SERVER, not the nginx web server!

    The bug still exists, and this workaround should be deleted and a proper workaround written. It's 2017 - why is a 2 year old bug still not resolved properly? I've just installed a new instance of Plesk and I couldn't believe the problem is still there.

    As it stands, users have to copy a template file using the instructions at

    PLEASE DELETE THIS POST - it WILL NOT solve the problem because Plesk nginx templates do NOT take their information from panel.ini! It has wasted my time and caused frustration - and you'll see from other forum posts that other users have had exactly the same waste of time from following these instructions.

  • 0
    Del Corso

    I'm assuming that you're editing client_max_body_size so you can accept the upload of large files. So, aside from the usual apache and php settings you also have to edit something else. 

    As an example, if attempting to upload a 134MB file in your error logs you'll get something like this:

    [Tue Jun 06 19:06:11.237658 2017] [fcgid:warn] [pid 30592:tid 140115808524032] [client] mod_fcgid: HTTP request length 134222462 (so far) exceeds MaxRequestLen (134217728), referer:

    So, under Additional Apache Directives in your Plesk domain make sure to add this, for 512MB:

    FcgidMaxRequestLen 512000000

    Edited by Del Corso
  • 0
    Robert Asilbekov

    @Tony Collins  you are not quite correct. The resolution is for customer's websites nginx, not for sw-cp-server (Plesk). So if you still experience the error consider to review your custom templates. As the solution in the article works fine and can be verified by executing "nginx -T" (it will dump running configuration)


Please sign in to leave a comment.