Мониторинг работы nginx

Василишин Андрей andron at kpi.ua
Tue Jan 15 23:59:11 MSK 2008


> 1. Отдача статики должна происходить с нгинкс.

Инеется в наличии файлообменник nginx+php-cgi
Все это не Linux Gentoo
Конфиг такой:
user  nginx nginx;
worker_processes  4;

#error_log  /var/log/nginx/error.log debug;

pid        /var/log/nginx/nginx.pid;

events {
    worker_connections  1024;
}

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

    log_format  main  '$remote_addr - $remote_user [$time_local] status'
                      '"$request" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
    client_max_body_size 2005m;
    server_names_hash_bucket_size 64;
    #upload_progress proxied 1m;
    client_body_temp_path /tmp/nginx;
    limit_zone   one  $binary_remote_addr  10m;
    limit_conn   one  3;
    keepalive_timeout 3;
    proxy_buffering off;
    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;

    server {
        listen       80;

     server_name  filestore.com.ua;

        access_log  /var/log/nginx/host.access.log  main;
        error_log   /var/log/nginx/host.error.log  debug;
        location / {
            root   /storage/htdocs;
            rewrite ^/0(.*)$ /download.php?file=$1 last;
            index  index.php index.htm index.html;
            #proxy_pass http://127.0.0.1;
            #track_uploads proxied 30s;
            #client_max_body_size 2005m;
        }


        # pass the PHP scripts to FastCGI server listening on
        #
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:8888;
            fastcgi_index  index.php;

            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            fastcgi_read_timeout 180;
            fastcgi_buffers 4 32k;
            fastcgi_busy_buffers_size 32k;
            fastcgi_temp_file_write_size 32k;

                    fastcgi_param  SCRIPT_FILENAME 
/storage/htdocs$fastcgi_script_name;
                    fastcgi_param  QUERY_STRING     $query_string;
                    fastcgi_param  REQUEST_METHOD   $request_method;
                    fastcgi_param  CONTENT_TYPE     $content_type;
                    fastcgi_param  CONTENT_LENGTH   $content_length;

        }

        #location ^~ /progress { <-- какую папку указывать тут?
        #report_uploads proxied;
        #}
     }
}

Как сделать так, чтобы нгинкс отдавал файлы как статису, а не как поток 
с бекенда?
Имеет ли смысл переходить на nginx+apache mod_php, а то php-cgi имеет 
свойство подвисать (использую spawn-fcgi)?
Может кто сталкивался с модулем upload progress, как его настроить 
правильно, какую папку указывать в локейшене для upload progress?   
> 2. Ограничить кол-во соединений до 2-х по локейшну.
> 3. lsof -c nginx

nginx   18099 nginx   11u   REG        9,1       1886 2329969 
/var/log/nginx/error_log
nginx   18099 nginx   12u   REG        9,1          0 2329968 
/var/log/nginx/access.log
nginx   18099 nginx   13u   REG        9,1    3488432 2331233 
/var/log/nginx/host.access.log
nginx   18099 nginx   14u   REG        9,1    5154553 2333120 
/var/log/nginx/host.error.log
nginx   18099 nginx   28u  unix 0xf7533c80             323771 socket
nginx   18099 nginx   29u   REG        9,1  733998422 2312925 
/var/tmp/nginx/fastcgi/4/02/0000000024 (deleted)
nginx   18099 nginx   30u  unix 0xf7533040             323774 socket
nginx   18099 nginx   32u  unix 0xf6eaf580             323776 socket
nginx   18099 nginx   33u   REG        9,1  142659402 2330263 
/var/tmp/nginx/fastcgi/3/21/0000000213 (deleted)
nginx   18099 nginx   35u  unix 0xd618a3c0             323779 socket
nginx   18099 nginx   36u  0000        0,6          0     465 anon_inode
nginx   18099 nginx   39u  IPv4     330326                TCP 
filestore.com.ua:http->c-81-95-176-250.ihome.ua:4166 (ESTABLISHED)
nginx   18099 nginx   42u   REG        9,1   25436160  179284 
/var/tmp/nginx/fastcgi/2/15/0000000152 (deleted)

-- 
WBR, Andrey Vasilishin CDIG1-UANIC, CDIG1-RIPE






More information about the nginx-ru mailing list