caching static files for ruby on rails application using nginx
I have been trying for some time to serve & cache static files for my rails app using nginx. the rails app s开发者_JAVA技巧erver runs mongrel_cluster and is deployed on a different host than that of nginx.
following many of the available discussions I tried the following
server {
listen 80;
server_name www.myappserver.com;
ssl on;
root /var/apps/myapp/current/public;
location ~ ^/(images|javascripts|stylesheets)/ {
root /var/apps/myapp/current;
expires 10y;
}
location / {
proxy_pass http://myapp_upstream;
}
}
But nginx fails to find the images and to load the css and js files. Can anyone help me out here?
My aim is to configure nginx in such a way that it caches the static files till expiry.
Please suggest me some way to achieve this or am I missing any point here?
Hey there. I believe Ezra here @ Engine Yard wrote a blog post on this years ago. All of this works out of the box @ EY, so that is one way to utilize his expertise. :-)
精彩评论