Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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