Introduction
This guide will take you through the steps for configuring custom parameters for Nginx and PHP-FPM for your Magento 2 site on MDOQ managed Magento hosting.
Scenario
Quite a common issue for Magento 2 sites is attributes with lots of attribute options for a single attribute. e.g: color
and size
Quite often they contain in excess of 200 options.
This causes an issue because the size of the body can:
- be too large in terms of actual size
- be too large in terms of the number of parameters being sent
You will see this if you try to save an attribute with a lot of options and get a413
response.
Guide
When applying the changes to PHP-FPM and Nginx the site will experience a small amount of downtime, whilst the changes are applied.
-
Add an additional custom Nginx parameter to set
client_max_body_size
to10m
You do this by going to "Settings" > "Nginx" -
Add 3 additional custom PHP-FPM parameters
upload_max_filesize
=10M
post_max_size
=10M
max_input_vars
=2000
You do this by going to "Settings" > "PHP-FPM"
- You can then click "Save"
If you want to apply the changes now make sure "recreate modified components" is checked
N.B Applying this change will cause a small amount of downtime whilst the changes are applied
Once the recreate is finished, you should be able to test saving the attribute.
MDOQ development instances use the same configuration as production we would recommend you test changing these setting on a development instance first. (As you may need to increase the values even more.) Once you have confirmed the correct settings, apply these to production, this way you only have one instance of downtime.