Created
April 9, 2014 22:14
-
-
Save ch1ago/10324043 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 unicorn_proxy_api { | |
server proxy_api_1 fail_timeout=0; | |
server proxy_api_2 fail_timeout=0; | |
server proxy_api_3 fail_timeout=0; | |
server proxy_api_4 fail_timeout=0; | |
server proxy_api_5 fail_timeout=0; | |
server proxy_api_6 fail_timeout=0; | |
server proxy_api_7 fail_timeout=0; | |
server proxy_api_8 fail_timeout=0; | |
server proxy_api_9 fail_timeout=0; | |
} | |
upstream unicorn_proxy_app { | |
server proxy_app_1 fail_timeout=0; | |
server proxy_app_2 fail_timeout=0; | |
server proxy_app_3 fail_timeout=0; | |
} | |
server { | |
listen 80; | |
root /path/to/public; | |
server_name site.com; | |
location ^~ /api/ { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
if (!-f $request_filename) { | |
proxy_pass http://unicorn_proxy_api; | |
break; | |
} | |
} | |
try_files $uri/index.html $uri @unicorn; | |
location @unicorn { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
if (!-f $request_filename) { | |
proxy_pass http://unicorn_proxy_app; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment