During development or in production your may experience a 504 gateway timeout on your Magento site, this will usually be when performing a long running request, such as exporting your product catalog. Wherever possible long running tasks should be changed to jobs that notify you when complete, this avoids the need for having long running requests that can put load on your server. However in some cases this isn't possible or feasible. Luckily increasing the timeout when using MDOQ managed Magento hosting is pretty straight forward.
- Before starting make yourself a development instance
- Replicate that you still get the timeout on a development instance. (If you don't then this could indicate the issue was down to load and not the timeout, if this is the case for you then please reach out to MDOQ support so we can advise.)
- Open settings for your instance, then we need to add a custom variable to both PHP and Nginx
For PHP the variable is called `max_execution_time` it should look like this
For Nginx the variable is called `proxy_read_timeout` and it should look like this
You should always keep these variables the same value.
(N.B this value is seconds, so 300 seconds = 5 mins) - Once you have update the these settings click save and let MDOQ sync PHP-FPM and Nginx.
- You can then retest to see if the issue has gone away. If the issue hasn't gone away repeat 3-5 using a longer timeout. You are trying to find the lowest value where the issue is gone.
- Once happy change the setting on the production instance.
- To apply these settings to production.
Click the production instance > Sync > Select components to synchronize
Because this is production and we want as little down time as posssible, select "Enable advanced mode".
Select "only synchronize selected components"
Then Select: "PHP-FPM", "Site Nginx" and "SSH", it should look like this - You can then click "Synchronize" to apply these changes to production.
N.B this will cause a small amount of downtime whilst the changes are applied.