-
-
Save yesmeck/c81e5536a27800ea0d78 to your computer and use it in GitHub Desktop.
nginx
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:/path/to/app/tmp/sockets/unicorn.sock; | |
} | |
server { | |
server_name app.com; | |
root /path/to/app/public; | |
access_log /var/log/nginx/app.access.log main; | |
error_log /var/log/nginx/app.error.log warn; | |
location / { | |
try_files index.html $uri @app; | |
} | |
location ~ ^/(images|javascripts|stylesheets)/ { | |
expires 24h; | |
add_header Cache-Control public; | |
} | |
location ~ ^/assets/ { | |
access_log off; | |
expires 7d; | |
add_header Pragma public; | |
add_header Cache-Control "public"; | |
} | |
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://app_server; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment