How to tune nginx for 800-1200 concurrent connections?

dullnicker nginx-forum at
Mon Sep 19 14:29:29 UTC 2011

Dear all,

I run nginx as stand-alone webserver (not as Apache proxy) on an image
gallery website. The server has to handle up to 1,200 concurrent
connections on Port 80, the average number throughout the day is around
500-600. During peak times, the server suffers a bit under its load and
I wonder whether there is anything that I can do to decrease the load by
tuning the nginx config. I should add that Apache went nuts handling the
site and therefore nginx is already a great relief to have. The site has
just around 3,000 unique visitors but up to 250,000 pageviews per day.

Here are the relevant server specs:
4 cores at 2.1 GHz
1 GB RAM (average free RAM is around 800 MB even during peak times)

Here is my current nginx.conf:

user              nginx nginx;
worker_processes  8; # default: 2

error_log	logs/error.log;

pid               logs/;

events {
    worker_connections  2048; # default: 1024

http {
    include       mime.types;
    default_type  application/octet-stream;
    client_max_body_size 64M;
    sendfile        on;
    tcp_nopush      on;

    keepalive_timeout  20; #default: 3

    gzip  on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types      text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;

    server_tokens off;

    include /etc/nginx/conf.d/*;

Here are the fastcgi settings (The gallery is heavily PHP-driven):

   include fastcgi_params;
    fastcgi_intercept_errors on;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    try_files $uri =404;

I would appreciate your comments and suggestions a lot - Thank you very
much in advance!

Kind regards

Posted at Nginx Forum:,215383,215383#msg-215383

More information about the nginx mailing list