首页 文章

Nginx / FastCGI一直在崩溃

提问于
浏览
0

有没有Nginx / FastCGI大师可以帮助我?

我在Debian Squeeze上运行nginx 1.0.11服务Mono FastCGI(fastcgi-mono-server4 2.10.2.0) . 我注意到FastCGI实例经常崩溃以响应超过~350,000字节的POST请求 . 虽然这种规模的一些要求是成功的,但它们更有可能因流量增加而失败 . 此外,通常当FastCGI实例失败时,Nginx工作进程将被僵尸化(即Nginx仍处理请求但超时 - 尽管所有网关都可能已关闭,但不会返回502) . 我打开Nginx调试并在工作进程和FastCGI实例崩溃之前注意到以下内容 .

2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @360448 32768
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 32768, @360448 32768:32768
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 8
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: @393216 12167
2012/01/11 20:38:42 [debug] 1744#0: *141 sendfile: 12167, @393216 12167:12167
2012/01/11 20:38:42 [debug] 1744#0: *141 writev: 9
2012/01/11 20:38:42 [debug] 1744#0: *141 chain writer out: 0000000000000000
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer del: 16: 1326314382071
2012/01/11 20:38:42 [debug] 1744#0: *141 event timer add: 16: 60000:1326314382072

这些只是记录的最后10项,但是,如果你想看到更多,我当然可以发布或PM . 最后,这是我的Nginx配置文件 .

user                 www-data;
worker_processes     2;
worker_rlimit_nofile 8192;
events {
    worker_connections  2048;
    use                 epoll;
}

http {
    error_log               /var/log/error.log;
    include                 mime.types;
    default_type            application/octet-stream;           
    sendfile                on;
    keepalive_timeout       65;

    gzip              on;
    gzip_http_version 1.1;
    gzip_vary         on;
    gzip_comp_level   6;
    gzip_proxied      any;
    gzip_types        text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js font/opentype application/font-woff;
    gzip_buffers      16 8k;
    gzip_disable      "MSIE [1-6]\.(?!.*SV1)";

    upstream backend {
        server 127.0.0.1:8080;
        server 127.0.0.1:8081;
    }

    server {
        listen       80;
        server_name  my_server;
        root         /var/www;
        access_log   /var/log/host.access.log;

        location / {
            fastcgi_param            SCRIPT_FILENAME /scripts$fastcgi_script_name;
            include                  fastcgi_params;
            fastcgi_pass             backend;
            fastcgi_next_upstream    http_500 http_404 error timeout;
            fastcgi_read_timeout     60;
        }

        location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)$ {
            root /var/www;
        }
    }
}

1 回答

相关问题