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




  • Avatar

    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. 


  • Avatar
    Nikolay Zhmuk

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

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

  • Avatar
    Del Corso (Edited )

    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

  • Avatar
    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)


  • Avatar

    This workaround works, but it should be noted that the domains without any specific entry will now have a body_size of only 1 MB. This is the default value of Nginx.

    To resolve that you can create a new global entry of 128 MB by placing this value in a file in /etc/nginx/conf.d/


    grep 'client_max_body_size' /etc/nginx/conf.d/aa400_own_tweaks.conf

    client_max_body_size 128m;
  • Avatar
    Bulat Tsydenov

    @frater, if add 

    nginxClientMaxBodySize = 64m

    to '/usr/local/psa/admin/conf/panel.ini' configuration file and reconfigure all domains, this value will be applied for all the domains. You can check it:

    # grep client_max_body_size /var/www/vhosts/system/
    client_max_body_size 64m;
    client_max_body_size 64m;


  • Avatar
    frater (Edited )

    The Tutorial on which I was commenting doesn't say "nginxClientMaxBodySize = 64m"
    This working tutorial says "nginxClientMaxBodySize ="
    This is entirely different.

    What you propose is exactly what people coming to this page DO NOT want.
    It creates a "client_max_body_size 64m;" in each host (something you already found out as it seems).

    This makes it impossible to change that to another value for a particular host.
    Your proposed change will only change the 128m to a 64m value. The problem they had will stay.
    BTW.... It's not clear to me if you want to correct my post or you have a problem implementing this tutorial. If it's the latter then I found the reason; You need to lose the "64m".

    What "those people" want and what this tutorial offers is the removal of "client_max_body_size" in each host.
    This makes it possible to create a custom value in certain vhosts using the "Additional nginx directives"

    What this tutorial DOES NOT cover is a solution for the body size of the vhosts that have no custom value. While Plesk made sure each vhost had a body size of 128m, this isn't anymore after applying the tutorial.

    So, this tutorial will solve the original problem, but by doing so it also creates a new problem. vhosts without an entry in "Additional nginx directives" will get a body size of 1m (this is Nginx's default). 

    By adding this value (128m) for that directive in the file /etc/nginx/conf.d/aa400_own_tweaks.conf, you will make up for that. That will become the new default value for Nginx as it's placed outside of the vhosts.

  • Avatar

    The author of the tutorial wrote this additional sentence:

    "If the value is specified in panel.ini (e.g. "nginxClientMaxBodySize = 64m") default client_max_body_size value will be overridden server-wide."

    It has nothing to do with the scope of this article and is even confusing for people that do not read the article with care.
    I think it's best to just remove that sentence.
    The sentence is also ambiguous as "server-wide" should really be "for all vhosts".

  • Avatar
    Bulat Tsydenov

    @frater Thank you for such detailed response and for taking part in improving our Knowledge Base! I got your points and I agree with them, the article was updated accordingly.

  • Avatar
    adrianTNT (Edited )

    Note to self: notice the two different variable names: client_max_body_size in nginx conf and nginxClientMaxBodySize in Plesk ini.

  • Avatar
    Ivan Postnikov

    @adrianTNT, yes, indeed client_max_body_size is for Nginx and nginxClientMaxBodySize is for Plesk panel.ini.

  • Avatar

    Sadly, this article is not helpful at all!

    I've applied the above solution to two independent Plesk Onyx servers with the newest updates installed and yet it wouldn't let me save the setting in the Nginx settings. Sadly, the only working solution is removal of Nginx extension at the moment. I suggest everyone not to waste time with the above solution as it does not work on a fresh install.

  • Avatar
    Ivan Postnikov

    Hello @Daniel, I have checked the instruction on Plesk Onyx 17.8.11 Update #11 and CentOS 7.4.1708. After doing all the steps I have managed to specify client_max_body_size in additional Nginx directives.

    Please, let me know the exact Plesk version (17.0/17.5/17.8) and the OS version and what exact error message is displayed.

  • Avatar

    When will this be fixed? 

    I got same errors today. 

    No Chance. 

  • Avatar
    Anzhelika Khapaknysh

    Hi @Lenor,

    Currently, there is no ETA regarding the fix.
    So I'd recommend applying the workaround suggested.

    Feel free to follow this article to be updated once the bug is fixed.

  • Avatar

    As in nginx.conf there is this line:

    http {
    include mime.types;
    default_type application/octet-stream;

    proxy_read_timeout 180;
    proxy_buffer_size 128k;
    proxy_buffers 4 256k;
    proxy_busy_buffers_size 256k;
    client_max_body_size 128m; <==

    ... .. .

    You can exlude the first step

    # echo 'client_max_body_size 128m;' > /etc/nginx/conf.d/aa_client_max_body.conf

    and do only the modification in "panel.ini":

    nginxClientMaxBodySize =
  • Avatar
    Vladimir Chernikov

    Hello @Ops-team,

    Thank you for sharing your experience!

    The step is required to keep 128m as default value for the client_max_body_size directive server-wide. By default server-wide value is 1m.

Please sign in to leave a comment.

Have more questions? Submit a request