504 Gateway Time out

I just switch between apache to ngix, after set it up everything ( the
php and ngix ) everything is fine but only after certain amount of time
i got 504 gateway time-out.

Form the error log i got is :

"2010/05/14 23:50:38 [error] 5024#4444: *1985 upstream timed out (10060:
A connection attempt failed because the connected party did not properly
respond after a period of time, or established connection failed because
connected host has failed to respond) while connecting to upstream,
client : … "

I have been using the search here to find what will be the problem but
most of the reply here is about increasing the

  • max_execution_time
  • fastcgi_read_timeout

from the task manager i can see php-cgi.exe were not there when the web
got the 504 error. It seems been kill by something. I really think it is
about the php.ini problems. For the time being i just increase the
fastcgi_read_timeout to higher value because i do not know why does this
happens.

Below is my nginx config. :

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local]

“$request” ’
# '$status $body_bytes_sent “$http_referer” ’
# ‘"$http_user_agent" “$http_x_forwarded_for”’;

#access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   html;
        index  index.html index.htm, index.php;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on

127.0.0.1:9000
#
location ~ .php$ {
root html;
fastcgi_read_timeout 180;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
c:/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}

rewrite ^/notice.htm /notice.php last;
rewrite ^/home.html /index.php last;
rewrite ^/(.).asp /index.php last;
rewrite ^/index.html /index.php last;
rewrite ^/(.
).asp /$1.php last;
rewrite ^/sig-(.)-(.)-(.).sig /sig.php?n($1)t($2)f($3) last;
rewrite ^/(.
).html /index.php?write=$1 last;
}

# another virtual host using mix of IP-, name-, and port-based

configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}


# HTTPS server
#
#server {
#    listen       443;
#    server_name  localhost;

#    ssl                  on;
#    ssl_certificate      cert.pem;
#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;
#    ssl_ciphers

ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
# ssl_prefer_server_ciphers on;

#    location / {
#        root   html;
#        index  index.html index.htm;
#    }
#}

}

I really not good in php ( actually i just starting to learn it ) and
setting this kind of things but i learn from the documentation, post and
google for problems :smiley:

Anyway i hope i can get reply on this.

Thanks