Created
October 1, 2011 17:45
-
-
Save mm53bar/1256397 to your computer and use it in GitHub Desktop.
nginx vhost file that I use in sprinkles recipe
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 app_server { | |
| server unix:/var/applications/<%= APP_NAME %>/current/tmp/sockets/unicorn.sock fail_timeout=0; | |
| } | |
| server { | |
| listen 80; | |
| server_name www.<%= HOST %>; | |
| rewrite ^/(.*) http://<%= HOST %>/$1 permanent; | |
| } | |
| server { | |
| listen 80; | |
| server_name <%= HOST %> <%= "*.#{HOST}" %>; | |
| client_max_body_size 4G; | |
| access_log /var/applications/<%= APP_NAME %>/current/log/access.log; | |
| error_log /var/applications/<%= APP_NAME %>/current/log/error.log; | |
| root /var/applications/<%= APP_NAME %>/current/public/; | |
| try_files $uri/index.html $uri.html $uri @app; | |
| error_page 502 503 =503 @maintenance; | |
| error_page 500 504 =500 @server_error; | |
| location @app { | |
| proxy_set_header X-Real-IP $remote_addr; | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $http_host; | |
| proxy_redirect off; | |
| # enable this if and only if you use HTTPS, this helps Rack | |
| # set the proper protocol for doing redirects: | |
| # proxy_set_header X-Forwarded-Proto https; | |
| proxy_pass http://app_server; | |
| } | |
| location @maintenance { | |
| root /var/applications/<%= APP_NAME %>/current/public; | |
| try_files $uri $uri/ /503.html =503; | |
| } | |
| location @server_error { | |
| root /var/applications/<%= APP_NAME %>/current/public; | |
| try_files $uri $uri/ /500.html =500; | |
| } | |
| location = /favicon.ico { | |
| expires max; | |
| add_header Cache-Control public; | |
| } | |
| } | |
| server { | |
| listen 80; | |
| server_name assets.<%= HOST %>; | |
| root /var/applications/<%= APP_NAME %>/current/public/; | |
| gzip_static on; | |
| expires max; | |
| add_header Cache-Control public; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment