Open yourivdlans opened 10 years ago
Thanks for pointing this out @yourivdlans! This will probably involve a bit more in the Chef recipes for the passenger stack because passenger takes care of serving assets as static files itself. To work around this, we probably need something like the following sample.
In this sample, we will try to load the URL first via try_files
so it will use the location ~ ^/(assets)/
directive. If it can't find the file, it will try to run it from passenger.
server {
...
root /u/apps/railsapp/current/public;
try_files $uri @passenger;
location @passenger {
passenger_enabled on;
}
location ~ ^/(assets)/ {
root /u/apps/railsapp/current/public;
gzip_static on; # to serve pre-gzipped version
expires max;
add_header Cache-Control public;
}
...
}
Looks like we also need to pass an option to Passenger when compiling with nginx From the rails docs:
If you're compiling nginx with Phusion Passenger you'll need to pass that option when prompted.
@jvanbaarsen We don't compile passenger or nginx. Passenger and nginx is installed form the Phusion deb repositories in the Rails cookbook.
@michiels Ok, so that means we cant pass in the flag for gzip content? or is that passed in by default?
@jvanbaarsen It's passed by default. I don't think we need to change anything in how we install passenger itself for this issue.
@michiels Ok thanks!
At this time the nginx configuration does not include a config for serving static gzip content. See the rails guides for the actual config:
http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression