I have been trying for some time to serve & cache static files for my rails app using nginx. the rails app server 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?