504 Gateway Time out Nginx 1.0.4: Upstream time out

I am using NGINX 1.0.4 on Redhat Linux 5 and I am having the error
message: 504 Gateway Time out NGINX 1.0.4

HERE IS THE DETAIL OF MY ERROR.LOG FILE;

2011/11/03 09:05:11 [error] 22348#0: *898 upstream timed out (110
Connection timed out) while reading response header from upstream,
client:172.16.19.180, server: mcb-http-t.jlg.com, request: “POST
/ole/findshipto.jsp HTTP/1.1”, upstream:
http://172.21.68:80/ole/findshipto.jsp”, host: “mcb-htp-t.jlg.com”,
referrer: :https://mcb-http-t.jlg.com/ole/findshipto.jsp"

Please some one help me as I am new to NGINX:

HERE IS MY PROXY CONFIGURATION FILE:

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body-size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
proxy_buffers 32 4k;
client_body_timeout 300;
proxy_ignore_client_abort on;

I WILL APPRECIATE YOUR HELP IN SOLVING THIS PROBLEM. THANKS IN ADVANCE

Hello!

On Thu, Nov 03, 2011 at 04:29:45PM +0100, Roger G. wrote:

referrer: :https://mcb-http-t.jlg.com/ole/findshipto.jsp"
[…]

proxy_read_timeout 300;

The error suggests you backend doesn’t handle requests properly/in
time. If it’s expected that request may take longer than 300
seconds to complete - you may want to tune proxy_read_timeout. If
not - your backend is probably overloaded or not working at all,
and you may want to fix it or add more backends.

Maxim D.

Thanks for your help. I know my question will sound little ackward but
I am new to all this: How do I tune proxy_read_tomeout?

How do I check the backend to see if it is overloaded? or not working at
all?

How do I fix the backends or add more to it?
Thanks a lot for taken time to help me on this.

proxy_connect_timeout 10m;
proxy_send_timeout 10m;
proxy_read_timeout 8m;

Is it too long?

2011/11/5 Roger G. [email protected]

HERE IS MY NGINX.CONF FILE DETAIL:

user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx/nginx.pid;

events {
worker_connections 2048;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log    /var/log/nginx/access.log;

sendfile        on;
tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout   3;
tcp_nodelay        off;
ignore_invalid_headers on;

gzip  on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

gzip_comp_level 6;
gzip_static on;
gzip_min_length 2200;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/x-javascript image/x-icon 

text/xml application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

}

AND HERE IS MY PROXY.CONF FILE DETAIL

#proxy.conf
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_body_buffer_size 256k;
 proxy_connect_timeout   10m;
 proxy_send_timeout      10m;
  proxy_read_timeout      8m;
 client_header_timeout   10m;

proxy_buffers 32 4k;
client_body_timeout 800;
proxy_ignore_client_abort on;

client_header_buffer_size 1k;
large_client_header_buffers 8 8k;
client_max_body_size 2g;

        postpone_output 1460;