Skip to content

Instantly share code, notes, and snippets.

@aiwilliams
Created November 20, 2010 16:30
Show Gist options
  • Save aiwilliams/707940 to your computer and use it in GitHub Desktop.
Save aiwilliams/707940 to your computer and use it in GitHub Desktop.
unicorn/nginx dev setup
worker_processes 1;
events {
worker_connections 1024;
accept_mutex off; # "on" if nginx worker_processes > 1
}
http {
include 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"';
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 500;
gzip_disable "MSIE [1-6]\.";
client_max_body_size 5M;
client_body_buffer_size 128k;
upstream unicorn_tqserver {
server unix:<APPROOT>/tmp/sockets/unicorn.sock
fail_timeout=0;
}
server {
listen 80;
server_name *.tqserver.dev;
root <APPROOT>/public;
access_log <APPROOT>/log/nginx_access.log main;
error_log <APPROOT>/log/nginx_error.log debug;
charset utf-8;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://unicorn_tqserver;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root <APPROOT>/public;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment