Static usage

Davide D'Amico davide.damico at contactlab.com
Wed Jan 6 00:26:03 MSK 2010


Hi, I'm using nginx-0.7.64 on FreeBSD 7.2-p4 amd64 server (Dell R200, raid1 sata disk, 4gb ram)
I enabled server status with:

 location /status {
  stub_status on;
  access_log   off;
  allow 172.16.16.0/24;
  allow 172.16.7.249;
  deny all;
}

to see how many connections I can manage.

Using cacti to display statistics I saw that I have a max value of: 
600 clients active
12 clients reading
63 clients waiting
600 client writing

The question is: is it the best I can with this server and this configuration?

Thanks in advance,
d.



This is my configuration:

dave at web1:/usr/local/etc/nginx> more nginx.conf
worker_processes  5;

events {
    worker_connections  4096;
}

http {
    server_names_hash_bucket_size 64;

    include             /usr/local/etc/nginx/mime.types;
    default_type        application/octet-stream;

    log_format upstream '$remote_addr - $host [$time_local] '
                    '"$request" $status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for" [$upstream_addr]';

    access_log          /var/log/nginx/nginx-access.log upstream;
    error_log           /var/log/nginx-error.log;

    # spool uploads to disk instead of clobbering downstream servers
    client_body_temp_path /var/spool/nginx-client-body 1 2;
    client_max_body_size 32m;
    client_body_buffer_size    2048k;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         off;

    keepalive_timeout   2;

    # proxy settings
    proxy_redirect     off;
    
    proxy_set_header   Host             $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    proxy_max_temp_file_size 0;

    proxy_connect_timeout      180;
    proxy_send_timeout         180;
    proxy_read_timeout         180;

    proxy_buffer_size          32k;
    proxy_buffers              4 64k;
    proxy_busy_buffers_size    64k;
    proxy_temp_file_write_size 64k;
    include             /usr/local/etc/nginx/sites/*.conf;
}

A vhost config file:

upstream 1_2_4_backend  {
  server 172.16.7.121:80;
  server 172.16.7.122:80;
  server 172.16.7.124:80;
  server 127.0.0.1:8080 backup;
}


proxy_cache_path /usr/local/www/cache_leiweb levels=1:2 keys_zone=LEIWEB:10m inactive=24h max_size=1g;
server {
  server_name blog.leiweb.it;
  listen 172.16.7.130:80;
  access_log    /var/log/nginx/blog_leiweb.log upstream;

  proxy_redirect     off;
  proxy_set_header   Host             $host;  proxy_set_header   X-Real-IP        $remote_addr;
  proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
  proxy_store_access   user:rw  group:rw  all:r;

  proxy_temp_path /usr/local/tmp;

  location / {
    proxy_pass http://1_2_4_backend;
  }

  location ~ \.(gif|jpg|png|css)$ {
    proxy_pass http://1_2_4_backend;
    proxy_cache LEIWEB;
    proxy_cache_valid 200 10m;
    proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
  }

  location ~ .*/wp-admin/.* {
    proxy_pass           http://1_2_4_backend;
    proxy_redirect     off;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  }
  location ~ .*/wp-includes/.* {
    proxy_pass           http://1_2_4_backend;
    proxy_redirect     off;
    proxy_set_header Host $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  }

  location ~ .*/wp-login\.php.* {
    proxy_pass           http://1_2_4_backend;
    proxy_redirect     off;
    proxy_set_header Host $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  }

  location ~ .*/xmlrpc\.php.* {
    proxy_pass           http://1_2_4_backend;
    proxy_redirect     off;
    proxy_set_header Host $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  }

  location ~ .*/feed_m.* {
    proxy_pass           http://1_2_4_backend;
    proxy_redirect     off;
    proxy_set_header Host $host;
    proxy_set_header   X-Real-IP        $remote_addr;
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

  }

}





d.






More information about the nginx mailing list