1

how is this config? is there anyway i can tune it to handle more hits faster and better? im sitting on 2GBs of ram and a quad core

user  nobody;
worker_processes  4;
error_log  /var/log/nginx/error.log debug;
worker_rlimit_nofile 32768;
events {
 worker_connections 8192; # increase for busier servers
 use epoll; # you should use epoll here for Linux kernels 2.6.x
 multi_accept on;
}
http {
 server_name_in_redirect off;
 server_names_hash_max_size 2048;
 server_names_hash_bucket_size 256;
 include    mime.types;
 default_type  application/octet-stream;
 server_tokens off;
 sendfile on;
 tcp_nopush on;
 tcp_nodelay on;
 keepalive_timeout  15;
 gzip on;
 gzip_vary on;
 gzip_disable "MSIE [1-6]\.";
 gzip_proxied any;
 gzip_http_version 1.1;
 gzip_min_length  0;
 gzip_comp_level  9;
 gzip_buffers  16 8k;
 gzip_types    text/* application/* image/*;
 open_file_cache max=1000 inactive=20s;
 open_file_cache_valid    30s;
 open_file_cache_min_uses 2;
 open_file_cache_errors   off;
 if_modified_since before;
 ignore_invalid_headers on;
 client_header_timeout  1m;
 client_body_timeout 1m;
 send_timeout     1m;
 reset_timedout_connection on;
 connection_pool_size  256;
 client_header_buffer_size 256k;
 large_client_header_buffers 4 256k;
 client_max_body_size 4M;
 client_body_buffer_size 128k;
 request_pool_size  32k;
 output_buffers   4 32k;
 postpone_output  1460;
 proxy_cache_path /tmp/nginx/cache levels=1:2 keys_zone=one:30m inactive=1d  max_size=500m;
 proxy_temp_path  /tmp/nginx/proxy;
 proxy_cache_key  "$scheme://$host$request_uri";
 client_body_in_file_only on;
 log_format bytes_log "$msec $bytes_sent .";
1
  • 1
    You're probably optimizing in the wrong place. Nginx is very unlikely to be your bottleneck, especially if you are proxying to Apache for something like Ruby or PHP. You should instead look to optimize your PHP/Ruby install and code. Feb 5, 2011 at 1:04

1 Answer 1

2

Looks good for me. Have you performed a stress test of this setup?

2
  • I kinda did... but it took the server down. i dont think ive got apache setup correctly or im not caching correctly or something. Feb 4, 2011 at 20:11
  • 1
    Okay, I think the next step is to diagnose the situation using top on a server under load. Most probably the problem is not on nginx side.
    – Alex
    Feb 4, 2011 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .