Skip to content

Instantly share code, notes, and snippets.

@ylluminate
Created August 20, 2012 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ylluminate/62a23445e1eb644df1db to your computer and use it in GitHub Desktop.
Save ylluminate/62a23445e1eb644df1db to your computer and use it in GitHub Desktop.
nginx and unicorn config files
upstream unicorn_appname {
server unix:/tmp/unicorn.appname.sock fail_timeout=0;
}
server {
# listen 80 default deferred;
listen 80;
server_name appname.com;
root /home/deployer/apps/appname/current/public;
access_log /var/log/nginx/appname.com.access.log;
error_log /var/log/nginx/appname.com.error.log;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn_appname;
location @unicorn_appname {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn_appname;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
upstream unicorn_appname_staging {
server unix:/tmp/unicorn.appname_staging.sock fail_timeout=0;
}
server {
# listen 80 default deferred;
listen 80;
server_name staging.appname.com;
root /home/deployer/apps/appname/staging/current/public;
access_log /var/log/nginx/staging.appname.com.access.log;
error_log /var/log/nginx/staging.appname.com.error.log;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
try_files $uri/index.html $uri @unicorn_appname_staging;
location @unicorn_appname_staging {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn_appname_staging;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
nginx version: nginx/1.2.2
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.2.2/debian/modules/nginx-dav-ext-module
listen "/tmp/unicorn.appname.sock"
worker_processes 8
timeout 30
root = "/home/deployer/apps/appname/staging/current"
working_directory root
pid "#{root}/tmp/pids/unicorn.pid"
listen "/tmp/unicorn.appname_staging.sock"
worker_processes 1
timeout 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment