• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Setting default client_max_body_size

AdrianC

Basic Pleskian
I need to increase the value of client_max_body_size in order to upload larger files on my website.
The default that plesk sets in these files is 128M:

/var/www/vhosts/system/[DOMAIN]/conf/nginx.conf
/var/www/vhosts/system/[DOMAIN]/conf/nginx.conf.bak
/var/www/vhosts/system/[DOMAIN]/conf/nginx_ip_default.conf.bak
/var/www/vhosts/system/[DOMAIN]/conf/nginx_ip_default.conf

I tried changing default value in /etc/nginx/nginx.conf to one of these

client_max_body_size 0;
client_max_body_size 512M;

But none worked, I set it , restarted nginx and apache and I still got the error when uploading.
The above vhost config files also still contain the 128M value.

I tried removing value from /etc/nginx/nginx.conf and adding it to:

Plesk interface > service plan > web server > nginz directives

I applied changes, synced the plan, I still get the error.

Is there a way to globally set this without creating/editing these custom files for each individual domain ?

vhost.conf , vhost_ssl.conf, vhost_nginx.conf ?

// these settings overlap is very confusing, maybe Plesk can do like a simple debug.php file that can run on final website and print all options that got loaded in the end (nginx limits, apache limits, fcgid limits, php limits) they all overlap one another in addition to plesk service plan, vhost, etc) very confusing.
 
Hi AdrianC,

you have the possibility to change/edit/modify the standart settings for "client_max_body_size". Add into "/usr/local/psa/admin/conf/panel.ini" the additional modification:

Code:
[webserver]
nginxClientMaxBodySize = 128m

Afterwards, reconfigure your configuration files pls. with the command:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
( a nginx restart should be done automatically, if it's not done, the changes will not apply, untill you restart nginx )


Now that each (sub)domain has a standart setting, this doesn't limit you at all. If you desire another setting, just set an "Additional nginx directive" at EACH (sub)domain over the Plesk Control Panel, where you could raise the standart to something you desire:
Code:
client_max_body_size 512m



Additional note:
You might not yet have the "panel.ini" - file on your server, but instead, the standart "panel.ini.sample" is existent in the mentioned folder. Just copy the file to "panel.ini" in order to modify some standart settings over this *.ini - file. ;)
Code:
cp /usr/local/psa/admin/conf/panel.ini.sample /usr/local/psa/admin/conf/panel.ini


Edited 03.08.2017:
This recommendation doesn't work as suggested by now. Pl.s follow the next suggestion(s) in this thread to solve your issues/erors/problems correctly!
 
Last edited by a moderator:
Thanks UFHH01 :) , I avoided editing panel.ini because it didn't exist by default.
I was able to fix this just a bit before seeing your reply and I came here to write the solution.

My troubleshooting tips:

- See client_max_body_size value in /var/www/vhosts/system/[DOMAIN]/conf/nginx.conf (128M default for me).
- Edit/create /usr/local/psa/admin/conf/panel.ini and add value there (different format):

Code:
[webserver]
nginxClientMaxBodySize =512M;

restart nginx and reconfigure vhosts
Code:
plesk sbin httpdmng --reconfigure-all
service nginx restart

- check client_max_body_size value again in /var/www/vhosts/system/[DOMAIN]/conf/nginx.conf , should contain the new value from panel.ini
 
Hi AdrianC,

you have the possibility to change/edit/modify the standart settings for "client_max_body_size". Add into "/usr/local/psa/admin/conf/panel.ini" the additional modification:

Code:
[webserver]
nginxClientMaxBodySize = 128m

Afterwards, reconfigure your configuration files pls. with the command:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all
( a nginx restart should be done automatically, if it's not done, the changes will not apply, untill you restart nginx )


Now that each (sub)domain has a standart setting, this doesn't limit you at all. If you desire another setting, just set an "Additional nginx directive" at EACH (sub)domain over the Plesk Control Panel, where you could raise the standart to something you desire:
Code:
client_max_body_size 512m

This actually isn't correct.

You need to add "nginxClientMaxBodySize" without a value to the panel.ini to make it work.

Code:
[webserver]
nginxClientMaxBodySize =

Without a value you now have the freedom to set ClientMaxBodySize for each domain in the Plesk panel.

This is also stated here: Invalid nginx configuration: nginx: [emerg] "client_max_body_size" directive is duplicate
 
Hi DigitalExit,

This actually isn't correct.
You are right... my recommendation doesn't work anymore, as Plesk changed depending settings and configurations by now.

The mentioned KB - article "213914565" is valid as well for Plesk Onyx ( last updated = 2017-07-31 14:32:17 UTC ) and should be followed by now. ;)
 
Back
Top