Skip to content

Instantly share code, notes, and snippets.

@ryjkov
Created December 26, 2011 13:59
Show Gist options
  • Select an option

  • Save ryjkov/1521208 to your computer and use it in GitHub Desktop.

Select an option

Save ryjkov/1521208 to your computer and use it in GitHub Desktop.
nginx.conf
user nginx;
# Число рабочих процессов, рекомендуется ставить по количеству ядер
worker_processes 8;
# Уменьшает число системных вызовов gettimeofday(), что приводит к увеличению производительности
timer_resolution 100ms;
# Изменяет ограничение на число используемых файлов RLIMIT_NOFILE для рабочего процесса.
worker_rlimit_nofile 8192;
# Директива задаёт приоритет рабочих процессов от -20 до 20 (отрицательное число означает более высокий приоритет).
worker_priority -5;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 2048;
# use kqueue; для freebsd (рекомендация от psihoz)
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
# Включить sendfile(). Использование sendfile() экономит системные вызовы, уменьшает число копирований данных,
# позволяет использовать меньше физической памяти.
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_min_length 1100;
gzip_buffers 64 8k;
gzip_comp_level 3;
gzip_http_version 1.1;
gzip_proxied any;
gzip_types text/plain application/xml application/x-javascript text/css;
# Load config files from the /etc/nginx/conf.vs directory
include /etc/nginx/conf.vs/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment