504 Gateway upstream timed out (110: Connection timed out)

504 Gateway Time-out

check out error.log
> [error] 7036#0: *75024 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "PURGE /section/supercar.html HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "127.0.0.1"

how can I solve this issue?

7 Replies

I did check out these two links…

http://www.linode.com/forums/viewtopic.php?p=26452

http://forum.linode.com/viewtopic.php?p=31257

and this one

http://wiki.nginx.org/NginxHttpProxyMod … ad_timeout">http://wiki.nginx.org/NginxHttpProxyModule#proxyreadtimeout

I am using two 512 linode. One for app the other for database.

The site is on wondpress under the heaviest loads I was using more than 485MB of the allocated RAM. Usually, though the site pushes 400MB.

I got php5-cli php5-cgi psmisc spawn-fcgi installed. Also, I am using nginx,fastcgi, php5-fpm, varnish, apc

/usr/bin/php-fastcgi: /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -C 6 -u $FASTCGI_USER -f /usr/bin/php5-cgi

maybe up the children 6 at a time ???

since, I am using APC and php5-fpm… is there a way not to have kill the children when they reach a specified number of requests and respawn fresh ones

I find increasing the number of php fcgi processes past 4 doesn't help, in fact it can make things worse, one php process per core tends to be a good rule, one question, why are you sending purge requests to php?

PURGE /section/supercar.html HTTP/1.0

where should I send it to? How would you do it?

Something is sending 'purge requests to php' I guess. To be honest with you, I don't even know what that means. I just took settings for php5-fpm, varnish, apc etc from here and there to speed up the server.

When I get heavy load on the server, it gets time out. The time out could be normal, however, when I look at the error log, I see it gets stuck somewhere.

Sounds like you've over complicated your setup, varnish handles the purge request see https://www.varnish-cache.org/trac/wiki/Purging

If you answer a few questions I'll be able to give better advise.

1) What web server are you running

2) Why are you using PHP-FPM and how did you install it

3) What software are you running i.e wordpress/drupal etc

4) What's your database back end? i.e MySQL

Thank you for the link. I am still at a loss on this at the moment.

1) What web server are you running

ubuntu 10.04 - nginx, php5-fpm, varnish, wordpress plugin w3tc (total cache), apc. I also have memcached, and php5-memcache installed. However, since I have 'one app server' memcache isnt active at the moment.

I am wondering if I should install apache2 and have nginx in the front. Any thought on this?

I used these three links. They are similar to each other, one covers more information on what others lack.

http://danielmiessler.com/blog/optimizi … -memcached">http://danielmiessler.com/blog/optimizing-wordpress-with-nginx-varnish-w3-total-cache-amazon-s3-and-memcached

http://blog.nas-admin.org/?p=25

http://tutspundit.com/how-to-install-ng … ss-part-2/">http://tutspundit.com/how-to-install-nginx-php-fpm-mysql-php533-wordpress-part-2/

my settings are combination of those set ups. If you require, I will post my own settings.

I believe it was fast when I solely used danielmiessler's link. When I mix it with tutspundit set up, I think server slow down a bit. However, I didn't benchmark it piece by piece. It is just an overall observation at the moment. I hoped that when the server hits heavy load, it will stay up and serve properly. So, I hope tutspundit's setting provided a better robustness.

I have two 512MB servers. One app server, and the other data server. Eventually, I will add one more app server, and balance it with node balancer.

2) Why are you using PHP-FPM and how did you install it

I need the site to fly without hick ups. The site was slow with Apache, and the server prone to crash on load. When I was on apache, I had everything on the same server. The data, and the app were on the same server without any optimization. I separated the app and the data to two separate servers and opted for nginx instead of apache. Nginx wasnt amazing out the box, but the cpu, memory, and IO rate was lower. So, I decided to bite the bullet to see how much I can squeeze started to optimize the set up.

10.04 server doesn't use php5-fpm. So, I grabbed it from ppa repo and installed it. Using ppa repo isn't highly recommended since it is not in the official release cycle, and several other issues. However, I might get the latest ubuntu distro since it has the latest php5 compare to 10.04 stable release.

3) What software are you running i.e wordpress/drupal etc

wordpress

4) What's your database back end? i.e MySQL

separate stand alone 512 server. This server only has mysql on it.

I really appreciate your help.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct