-
-
Save ingoclaro/5139929 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 app { | |
server unix:/var/www/app.com/shared/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
server_name www.app.com; | |
rewrite ^ $scheme://app.com$request_uri? permanent; | |
} | |
server { | |
server_name app.com; | |
client_max_body_size 2G; | |
server_name app.com; | |
keepalive_timeout 5; | |
root /var/www/app.com/current/public; | |
access_log /var/www/app.com/shared/log/access.log; | |
error_log /var/www/app.com/shared/log/error.log error; | |
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$ ){ | |
return 405; | |
} | |
location ~ "^/assets/(.*/)*.*-[0-9a-f]{32}.*" { | |
gzip_static on; # to serve pre-gzipped version | |
expires max; | |
add_header Cache-Control public; | |
} | |
location / { | |
gzip_static on; # to serve pre-gzipped version | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X_FORWARDED_PROTO $scheme; | |
proxy_set_header X-Request-Start 't=$start_time'; | |
proxy_set_header Host $http_host; | |
proxy_intercept_errors on; | |
proxy_redirect off; | |
try_files /system/maintenance.html /cache/$uri/index.html /cache/$uri.html $uri @app; | |
error_page 404 /404.html; | |
error_page 422 /422.html; | |
error_page 500 502 503 504 /500.html; | |
error_page 403 /403.html; | |
} | |
location @app { | |
proxy_pass http://app; | |
} | |
location = /favicon.ico { | |
expires 1w; | |
add_header Cache-Control public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment