YounoGateway Timeout

,

FR;

Bonjour les amis,

Wordpress donne un délai d’expiration 504 Nginx sur les pages lourdes. J’ai essayé de prolonger le temps de faire des choses, mais cela n’a pas fonctionné. vous pourriez jeter un oeil à https://easycomp.shop/producten/ par exemple. Merci encore.

Oui, je sais qu’on a beaucoup de produits à charger.

EN:
Hello friends,

Wordpress gives a 504 Nginx timeout on heavy pages. I tried to extend the time to do stuff but that didn’t work. you could have a look at https://easycomp.shop/producten/ for example. Thank you again.

Yes, I know we got lots of products to load.

NL:
Hallo vrienden,

Wordpress geeft op zware pagina’s een 504 Nginx timeout. Ik heb geprobeerd de time to do stuff te verlengen maar dat werkte niet. zou je eens kunnen kijken op https://easycomp.shop/producten/ bijvoorbeeld. Thank you again.

Ja ik weet het we hebben nogal veel producten te ladenSchermafbeelding 2020-10-16 om 23.47.34

loadcat

Well uuuh, not sure what you’re trying to do but if you’re knowingly loading a shitload of product, that may be the root cause of the issue … If you’re in a restaurant and somebody orders a sandwich and the sandwich takes more than four hours to arrive … at some point the client times-out and leaves. But the issue ain’t “how do I make it so that the client stays longer”, the issue is “how do I make it so that the sandwich takes less than four hours to arrive”.

2 Likes

Waauw Nice way to explain it but I already told you the same kinda.

Just navigate to that url I gave you. It just times out on loading bigger lunches, to put it in your terms

Yes I do reproduce the issue but can’t really help you more than that from a Yunohost point-of-vie … dunno what exactly you did, but you should just do your stuff differently so that it doesn’t take a huge amount of time to load …

Yes you could.

Which one is right tried the most common one but nope…

There are several ways to fix it:

  • For Nginx as Proxy (php-fpm disabled) To apply settings globally, increase the following timeout values by adding the file /etc/nginx/conf.d/timeout.conf and restarting ‘nginx’ service: # cat /etc/nginx/conf.d/timeout.conf
proxy_connect_timeout       600;
proxy_send_timeout          600;
proxy_read_timeout          600;
send_timeout                600;

If you only are able to increase timeout settings per domain, it can be done in this way: Plesk > Subscriptions > my.domain.com > Websites & Domains > Web Server Settings – add the lines to Additional Nginx directives

  • For Nginx + FastCGI (php-fpm enabled) Increase max_execution_time setting: Plesk > Subscriptions > test.com > Websites & Domains > test.com > PHP Settings – Set max_execution_time = 300 Change request_terminate_timeout parameter (commented by default) in /etc/php-fpm.d/www.conf (for Debian /etc/php5/fpm/pool.d/www.conf ) file:
request_terminate_timeout = 300

Add fastcgi_read_timeout variable inside the ‘nginx’ virtual host configuration: Plesk > Subscriptions > my.domain.com > Websites & Domains > Web Server Settings > Additional Nginx directives

fastcgi_read_timeout 300;

Add/increase the following values in the ‘http’ section of the /etc/nginx/nginx.conf file:

fastcgi_buffers 8 128k;
fastcgi_buffer_size 256k;

Restart both ‘apache’ and ‘nginx’.

==========================================

If above steps doesn’t work, try this one…

  1. Open your nginx.conf file located in /etc/nginx directory.
  2. Add this below piece of code under http { section:
client_header_timeout 3000;
client_body_timeout 3000;
fastcgi_read_timeout 3000;
client_max_body_size 32m;
fastcgi_buffers 8 128k;
fastcgi_buffer_size 128k;

Note: If its already present , change the values according.
3. Reload Nginx and php5-fpm.

$ service nginx reload
$ service php5-fpm reload

If the error persists, consider increasing the values.

=========================================

Changes in php.ini

Try raising max_execution_time setting in php.ini file (CentOS path is /etc/php.ini):

1 max_execution_time = 150

Changes in PHP-FPM

Try raising request_terminate_timeout setting in php.ini file (CentOS path is /etc/php-fpm.d):

1 request_terminate_timeout = 150

Changes in Nginx Config

Finally, add fastcgi_read_timeout variable inside our Nginx virtual host configuration:

1

2

3

4

5

6

7 location ~* .php$ {

include fastcgi_params;

fastcgi_index index.php;

fastcgi_read_timeout 150;

fastcgi_pass 127.0.0.1:9000;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

Reload PHP-FPM and Nginx

1

2 service php–fpm restart

service nginx restart

You do not understand what’s I’m saying … the issue does not lie in nginx or php … the issue is that the application itself is taking too much time to load the data or answer the request.

When your sandwich takes four hours to be made, the issue is not that you should wait longer. The issue to be investigated is why the sandwich takes four hours to be made instead of 5 minutes. Same here : if your app takes more than 40 seconds to load the page, the issue is not “how do i make nginx/php wait more”, the issue is that at most your app should take 5 seconds to answer the request - so what’s taking so long ?

I am not sure how much items you want to load per page (I cannot load the page, at all), but I think allowing increased loading time is not the way to go.

You should have a look to Wordpress plugins that generate cache. That way, Nginx will only have to load a pre-generated static page instead of generating all the pages on-the-fly each time you have a visitor.

Consider reducing the resolution of the pictures of your products too. (Again, I have no idea what your website looks like, I cannot load it).

Hmm could try that but therefor I have to gain acces to the admin so I rather fix it on the server side. Its about a 100.000 products or something :wink:

Hmm, it doesn’t happen on other WP Sites… Any other suggests?