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 "";
}
}
Written by yanhaoyang
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#