• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Template_Exception: nginx: [emerg] invalid max_size value "max_size=" in /etc/nginx/plesk.conf.d

taraftar

New Pleskian
How can this error be fixed?

Details:

[2020-10-11 22:53:33.670] ERR [util_exec] proc_close() failed ['/opt/psa/admin/bin/nginx-config' '-t'] with exit code [1]
[2020-10-11 22:53:41.610] ERR [panel] Apache config (16024495840.16543000) generation failed: Template_Exception: nginx: [emerg] invalid max_size value "max_size=" in /etc/nginx/plesk.conf.d/vhosts/tld.de.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed

file: /opt/psa/admin/plib/Template/Writer/Webserver/Abstract.php
line: 75
code: 0
nginx: [emerg] invalid max_size value "max_size=" in /etc/nginx/plesk.conf.d/vhosts/tld.de.conf:5
nginx: configuration file /etc/nginx/nginx.conf test failed
 
This is a Plesk bug with ID #PPPM-12428 which is going to be fixed in future Plesk updates.

As a workaround:
  1. Create a list containing the domains with Nginx caching enabled:
    Code:
    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -Ne "select d.id, d.name from domains d, dom_param dp, WebServerSettingsParameters ws where d.id = dp.dom_id and dp.param = 'webServerSettingsId' and dp.val = ws.webServerSettingsId and ws.name = 'nginxCacheEnabled' and ws.value = 'true'" > /tmp/domainsList.txt
  2. Identify the domains with a non-existing Nginx cache size:
    Code:
    # echo "-> START"; cat /tmp/domainsList.txt | while read ID DOM; do CHECK=`mysql -uadmin -p$(cat /etc/psa/.psa.shadow) -D psa -Ne "select d.id from domains d, dom_param dp, WebServerSettingsParameters ws where d.id = dp.dom_id and dp.param = 'webServerSettingsId' and dp.val = ws.webServerSettingsId and ws.name = 'nginxCacheSize' and d.id = $ID" | wc -l`; if [ $CHECK -eq 0 ]; then echo -e "--> Domain: $DOM\t ID: $ID"; fi; done; echo "-> FINISH"
  3. The previous command will show an output as follows:
    Code:
    -> START
    --> Domain: example.com ID: 3
    -> FINISH
  4. Set a valid Nginx cache size via Plesk GUI to the domains displayed in the previous step: Log in to Plesk GUI > Domains > example.com > Apache & Nginx Settings > Enable Nginx caching > Cache size > 64 MB > OK to apply the changes
 
thanks alot ... new issue is (translated from german)

I have not recieved any email

How can configuration files be rebuild?

Due to the following errors in the configuration templates, no new configuration files could be created for the Apache web server: nginx: [warn] duplicate MIME type "text / html" in /var/www/vhosts/system/tld.de/conf/vhost_nginx. conf: 10 nginx: [alert] mmap (MAP_ANON | MAP_SHARED, 5242880) failed (12: Cannot allocate memory) nginx: [alert] munmap (FFFFFFFFFFFFFFFF, 5242880) failed (22: Invalid argument) nginx: configuration file / etc / nginx /nginx.conf test failed. Detailed descriptions of the errors were sent to you by email. Please solve the problem and click here to rebuild the corrupted configuration files or click here to rebuild all configuration files.
 
1) I take it that you have corrected all issues with the syntax, but just to make sure, please run
# nginx -t
on the console to verify that it does not throw any errors. Proceed only if no errors are shown.

2) When it is not showing errors, go to "Tools & Settings" then "Webserver Configurations Trouble Shooter" and select "Rebuild"->"Broken". This will not actually rebuild any files in your case, because everything is already o.k., but it will make Plesk notice that there is no error, so that the error message will be removed from the GUI.
 
This unfortunately doesn’t work for me.

After changing Cache size > 64 MB it displays the same error so i cannot save the config.
Bildschirmfoto 2020-10-24 um 01.59.54.png
 
Last edited:
If Nginx does not know the "max_size" parameter, there is a chance that it is not the original Nginx that comes with Plesk, but an older, custom version. max_size is a parameter that goes along with Nginx cache configuration. It defines the maximum size the cache can grow to (with some exceptions).

OR (as we don't see what you have entered into the caching section of the Plesk page for Nginx), the VALUE entered is invalid. Please make a screenshot of the Nginx caching settings and post it here. Also make sure that Cache size is an integer not preceded or followed by spaces.
 
Hey Peter,

thank you for your answer.

My Nginx Version is as following:

Bildschirmfoto 2020-10-24 um 10.21.44.png

Here what i see when i entering the "Apache and Nginx Configuration"
Bildschirmfoto 2020-10-24 um 10.24.19.png

Bildschirmfoto 2020-10-24 um 10.24.45.png
Bildschirmfoto 2020-10-24 um 10.25.35.pngBildschirmfoto 2020-10-24 um 10.25.50.png

Then change Cache size > 64 MB and Time > 1 Day.

Then i press "Ok" and the message from above is shown
 
I can reproduce the error when I enter zero in the cache size input, but I can easily fix it by entering a correct value like 64. Only when I keep the 0 in the field, which is of course an invalid value for max_size, because it is not an integer plus activating the cache and setting it to 0 makes no sense, I get the same error.

I think you might solve the issue this way:
First set an integer value greater than 0 in the cache size field. Set a value greater than 0 in the cache time limit field.
Save that setting, regardless of the error message that might be displayed afterwards.
Then go to "Tools & Settings" > "Webserver Configurations Troubleshooter" and select "Rebuild broken".
 
Okay i changed Cache size > 64 MB and Time > 1 Day.

Strange is when i save, go out and afterwards back inside the Settings Cache Size is again -> 0 and Time also.

Then i go to "Tools & Settings" > "Webserver Configurations Troubleshooter" and select "Rebuild broken".
Bildschirmfoto 2020-10-24 um 10.56.10.png
 
This needs to either be corrected manually in the dataset that controls that domain or you need to probably remove the domain and re-create it afterwards.

You can try this before, but I doubt it will work:
1) Disable (uncheck) Nginx caching
2) On the Linux console run
# plesk repair domain <domain name>
 
Disabling Nginx was also not possible. It was not saved.

I find a other Solution with Wordpress Toolkit:

1) Deactivate Caching here for Wordpress that runs under broken Domain (This setting overrides the default setting whether caching is used under Nginx Config for me.):
Bildschirmfoto 2020-10-24 um 11.11.07.png
2) Go inside Nginx Settings or press the Settingsbutton next to Cachingswitch

3) Enter valid data for cache size and time, as mentioned above by @Peter Debik and save

4) Reactivate Caching over Wordpress Toolkit.

5) Then go to "Tools & Settings" > "Webserver Configurations Troubleshooter" and select "Rebuild broken".
 
1) I take it that you have corrected all issues with the syntax, but just to make sure, please run
# nginx -t
on the console to verify that it does not throw any errors. Proceed only if no errors are shown.

2) When it is not showing errors, go to "Tools & Settings" then "Webserver Configurations Trouble Shooter" and select "Rebuild"->"Broken". This will not actually rebuild any files in your case, because everything is already o.k., but it will make Plesk notice that there is no error, so that the error message will be removed from the GUI.
There is no "Webserver Configurations Trouble Shooter" ¯\_(ツ)_/¯ ?
 
Are you logged in with the user name "admin"?
If not, log out and log in again with the user name "admin".

If you are logged in as "admin" and cannot see Tools & Settings > Webserver Configurations Troubleshooter":
Are you in "Service provider view"?
If not, go to Tools & Settings > Interface Management and change the view.
 
Disabling Nginx was also not possible. It was not saved.

I find a other Solution with Wordpress Toolkit:

1) Deactivate Caching here for Wordpress that runs under broken Domain (This setting overrides the default setting whether caching is used under Nginx Config for me.):
View attachment 17780
2) Go inside Nginx Settings or press the Settingsbutton next to Cachingswitch

3) Enter valid data for cache size and time, as mentioned above by @Peter Debik and save

4) Reactivate Caching over Wordpress Toolkit.

5) Then go to "Tools & Settings" > "Webserver Configurations Troubleshooter" and select "Rebuild broken".

THIS, is the correct answer. Good Job!
 
Are you logged in with the user name "admin"?
If not, log out and log in again with the user name "admin".

If you are logged in as "admin" and cannot see Tools & Settings > Webserver Configurations Troubleshooter":
Are you in "Service provider view"?
If not, go to Tools & Settings > Interface Management and change the view.

I am Web Host (service) admin with full access. That link is not listed anywhere on Tools and Settings page.
 
Back
Top