0 votes
by Rookie
I am getting regular 504 gateway errors from NginX when updating 20+ of the 1,000 or so WooCommerce products on my site, at the same time. My idea was to increase the following timeout values by adding the file `/etc/nginx/conf.d/timeout.conf` and restarting the NginX service.

proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

This would apply it globally, so I would prefer to make this 'fix' on a per-domain basis. How should I do this with Webinoly, or maybe this is not the correct fix, or the way to do it.

Your advice, as always, would be much appreciated.

1 Answer

0 votes
by Expert

Hi Terence,

Whatever you put in conf.d folder will have a global effect, Webinoly have support for Custom Nginx rules per site, for example: /var/www/domain.com/custom-nginx.conf, you can read about this feature, here: https://webinoly.com/en/documentation/sites/#nginx

I don't think that Proxy Nginx directives will solve your issue (I may be wrong), because your WordPress sites are not using the Reverse Proxy configuration in Nginx.

What I recommend in this case, is that first of all you should check the PHP logs and of course Webinoly have support for it: sudo log -php, because I think PHP is not responding for some reason. We have two variables for this:

  • max_execution_time  (/etc/php/7.3/fpm/php.ini)
  • request_terminate_timeout (/etc/php/7.3/fpm/pool.d/www.conf)

Both of them are set to a value of 300 seconds (5 minutes), so I think that this time is more than enough to process almost any individual request, for this reason, I think this is not the cause of your issue, but you should consider it. 

If you prefer, you can found the PHP logs here: /var/log/php/7.3/fpm.log for more details.

Also, we have an NGINX directive fastcgi_read_timeout (/etc/nginx/conf.d/fastcgi.conf) that we have set to 30 seconds, maybe you should try increasing this value. Don't forget to restart Nginx to changes take effect sudo nginx -t && sudo service nginx reload.

Finally, you should check your server resources, maybe its time to migrate to a bigger server.

Please, tell me if you have any additional question and keep me posted if you solve this issue.


by Rookie
edited by

Many thanks for your detailed reply. You may well be right about the server resources. On a VPS that's easy to fix ~ just needs a little more money each month ~ but first I thought I'd take your advice and look at `fastcgi_read_timeout` and see what's cooking there.

I am now getting this warning...

`nginx: [warn] could not build optimal fastcgi_params_hash, you should increase either fastcgi_params_hash_max_size: 512 or fastcgi_params_hash_bucket_size: 64; ignoring fastcgi_params_hash_bucket_size`

...but when I look there is no `fastcgi_params_hash_max_size` either in the nginx.conf or the `/etc/nginx/conf.d/fastcgi.conf` or `/etc/nginx/nginx.conf` files.

I also read your earlier messages about `fastcgi_params_hash_max_size` is marked as an unknown directive. 

So now I am really confused. Can you shed some light on the matter?

by Expert
Don't worry about that "Warning", I understand it's totally annoying but it has been appearing in a random way. To be honest, I still don't know the cause of this message, but I'm sure is completely inoffensive and it does not represent any risk to your server.

I'm investigating this issue!
by Rookie
Its strange because it continues even if you reset the directive back to the original 30 seconds. No doubt I'll read about it being fixed one day, but until then I won't worry about it.

Thank you for your help.
by Rookie

In the meantime the constant 504's are slowing my workflow to a crawl so I am going to upgrade the server as I don't think its quite up to the job of handling 1,000 products in WooCommerce.  

Here's what the metrics look like...

by Expert
Nothing wrong in your metrics!

Any clue in PHP logs?
by Rookie
There are notices and warnings but I am trying but I think I am kidding myself if I think I understand it all.

Can I email it to you and get you to help me with it please?  If so, what address do I use?
by Expert
Yes, send it, you have my email address.
by Rookie

It turned out to be a PHP problem generated by a plugin which is not 7.3 compatible, which explains the other errors we were seeing.  The advice I got from the author was "PLease switch the PHP version to 7.1. It will solve the issue."  When I did that it started to run as it should do. Its a shame really because that means quite a performance hit which I have seen on my page load speed. Hopefully he will get with the program eventually.

by Expert

Glad to see your issue solved!

  • The BAD: You should try to avoid using "poorly coded" plugins.
  • The GOOD: With Webinoly is really easy switch the PHP versión.
by Rookie
edited by

As always, thank you for your excellent help.

P.S. Sometimes poorly coded plugins are all us non-developers have to choose from. laugh

Welcome to the Community site for Webinoly.

Our Optimized LEMP Web Server is a powerful set of commands for doing just about anything you could wish.

With Webinoly you can set up your NGINX web server in just one step.

* * * * * * *

If you have a question about Webinoly, please ask in English or Spanish.

To report a bug, please ask a question here with the bug tag.


Webinoly Support Paypal Donations Webinoly Support Bitcoin Donations

Your regular donations is what keep this project moving forward. If you like Webinoly, buy me a coffee or a beer to show support.

Affiliate Links

It is very important that any visitor to the site read the disclaimer, terms of use and privacy and legal statement before start browsing.