Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 .";
share|improve this question
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. – Martin Fjordvald Feb 5 '11 at 1:04

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

share|improve this answer
I kinda did... but it took the server down. i dont think ive got apache setup correctly or im not caching correctly or something. – John Thompson Feb 4 '11 at 20:11
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 '11 at 21:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.