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

Refers to:

  • Plesk 12.5 for Linux
  • Plesk 11.0 for Linux
  • Plesk 12.0 for Linux

Created:

2016-11-16 12:49:06 UTC

Modified:

2017-02-04 13:11:23 UTC

2

Was this article helpful?


Have more questions?

Submit a request

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

Symptoms

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/domain.com/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

Cause

This was considered an internal software issue with internal ID #PPPM-1914 .

Resolution

The issue will be fixed in future updates. Meanwhile, the following workaround can be applied:

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

    [webserver]
    nginxClientMaxBodySize =

    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
Please sign in to leave a comment.