Skip to content

Instantly share code, notes, and snippets.

@YanhaoYang
Created October 29, 2014 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YanhaoYang/5641abe7ab5630a9cebb to your computer and use it in GitHub Desktop.
Save YanhaoYang/5641abe7ab5630a9cebb to your computer and use it in GitHub Desktop.
nginx configuration for Rails page caching
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