Created
October 29, 2014 13:40
-
-
Save YanhaoYang/5641abe7ab5630a9cebb to your computer and use it in GitHub Desktop.
nginx configuration for Rails page caching
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
server { | |
listen 80; | |
server_name [domain name]; | |
root [Rails root]/public; | |
location @passenger { | |
passenger_enabled on; | |
passenger_app_env production; | |
} | |
location / { | |
error_page 418 = @passenger; return 418; | |
} | |
location ~ ^/assets/ { | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
add_header ETag ""; | |
add_header Last-Modified ""; | |
} | |
location ~ ^/[path]/? { | |
try_files $uri /system/$uri.html @passenger; | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
add_header ETag ""; | |
add_header Last-Modified ""; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment