:::: MENU ::::

Optimized Nginx config file

A useful Gzip + other optimized /etc/nginx/nginx.conf file

Thanks to http://brainspl.at/articles/2007/01/03/new-nginx-conf-with-optimizations


# user and group to run as
user www-data www-data;

# number of nginx workers
worker_processes 3;

# pid of nginx master process
pid /var/run/nginx.pid;

# Number of worker connections. 1024 is a good default
events {
worker_connections 1024;
}

# start the http module where we config http access.
http {
# pull in mime-types. You can break out your config
# into as many include’s as you want to make it cleaner
include /etc/nginx/mime.types;

# set a default type for the rare situation that
# nothing matches from the mimie-type include
default_type application/octet-stream;

# configure log format
log_format main ‘$remote_addr – $remote_user [$time_local] ‘
‘”$request” $status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;

# main access log
access_log /var/log/nginx/access.log main;

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

# no sendfile on OSX
sendfile on;

# These are good default values.
tcp_nopush on;
tcp_nodelay off;
# output compression saves bandwidth
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

#keepalive_timeout 0;
keepalive_timeout 65;

#vhost includes
include /etc/nginx/sites-enabled/*;

}


So, what do you think ?