Last active
August 29, 2015 14:02
-
-
Save ankion/783cf28b63a3ee70636c to your computer and use it in GitHub Desktop.
sample for nginx with unicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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