Skip to content

Instantly share code, notes, and snippets.

@ankion
Last active August 29, 2015 14:02
Show Gist options
  • Save ankion/783cf28b63a3ee70636c to your computer and use it in GitHub Desktop.
Save ankion/783cf28b63a3ee70636c to your computer and use it in GitHub Desktop.
sample for nginx with unicorn
upstream [project name]_unicorn_socket {
server unix:/home/deploy/[project name]/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name 192.168.3.103;
root /home/deploy/[project name]/current/public;
client_max_body_size 5M;
location ~* ^/assets/ {
expires 1y;
add_header Cache-Control public;
if ($request_filename ~* ^.*?\.(eot)|(ttf)|(woff)|(svg)|(otf)$){
add_header Access-Control-Allow-Origin *;
}
break;
}
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://[project name]_unicorn_socket;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment