gabriel / capitate

Capistrano recipes, plugins and templates.

capitate / lib / templates / nginx / nginx.conf.erb
100644 98 lines (75 sloc) 2.633 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#
# Nginx conf
#
# See vhost conf for site specific stuff.
#
# ==== References:
# http://brainspl.at/articles/2006/08/23/nginx-my-new-favorite-front-end-for-mongrel-cluster
# http://brainspl.at/articles/2007/01/03/new-nginx-conf-with-optimizations
# http://topfunky.net/svn/shovel/nginx
# http://robsanheim.com/2008/02/07/beware-the-default-nginx-config-old-ie6-hates-gzip/
#
# Nginx + memcached:
# http://www.igvita.com/2008/02/11/nginx-and-memcached-a-400-boost/
# http://blog.kovyrin.net/2007/08/05/using-nginx-ssi-and-memcache-to-make-your-web-applications-faster/
#
# Fair balancing:
# http://brainspl.at/articles/2007/11/09/a-fair-proxy-balancer-for-nginx-and-mongrel
 
 
# user and group to run as
user nginx nginx;
 
# number of nginx workers
worker_processes 6;
 
# pid of nginx master process
pid <%= nginx_pid_path %>;
 
 
events {
    worker_connections 1024;
}
 
 
http {
  include <%= File.dirname(nginx_conf_path) %>/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"';
 
  # 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;
 
  #keepalive_timeout 0;
  keepalive_timeout 65;
 
  # 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_buffers 16 8k;
  gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
  # GZip fails on pre SP2 IE6 browsers (even though is says it can)
  # Thanks, http://robsanheim.com/2008/02/07/beware-the-default-nginx-config-old-ie6-hates-gzip/
  # TODO: This doesn't work with our version of nginx
  #gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  #gzip_disable "MSIE [1-6]\.";
  
  # Auto include
  include /etc/nginx/vhosts/*.conf;
  
  # HTTPS server
  #
  #server {
  # listen 443;
  # server_name localhost;
 
  # ssl on;
  # ssl_certificate cert.pem;
  # ssl_certificate_key cert.key;
 
  # ssl_session_timeout 5m;
 
  # ssl_protocols SSLv2 SSLv3 TLSv1;
  # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
  # ssl_prefer_server_ciphers on;
 
  # location / {
  # root html;
  # index index.html index.htm;
  # }
  #}
 
}