ruby on rails - Have nginx serve up all files in a certain directory -


i want have nginx serve images in /public/system/articles/images in rails app. i've tried location /system { allow all; }

which when put in my_site.com/public/system/picture.png returns rails 404 page (as opposed nginx 404 page, or image i'm after).

this current conf file:

upstream varnish {     server localhost:6081; }  server {     listen 80;     server_name my_site.com;      location ~* \.(ico|css|js|gif|jpe?g|png)\?[0-9]+?$ {       expires max;       break;     }    root /home/my_site/my_site/current/public;    location /system {     allow all;   }    location @app {     proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;     proxy_set_header host $http_host;     proxy_redirect off;     proxy_set_header x-ai-app "my_site";     proxy_pass http://varnish;   }    #root /home/my_site/my_site/current/public;    location / {     # ip addresses listed here:       allow all;      try_files $uri @app;   }  } 

seems didn't need nginx conf files.

when trying access things under /public directory don't put /public in url you're calling.

so instead of my_site.com/public/system/picture.png should have been putting in my_site.com/system/picture.png


Comments