Serving Dynamic js files

Cliff Wells cliff at
Sat Jul 11 22:35:15 MSD 2009

On Sat, 2009-07-11 at 08:03 +0200, Qaiser Wali wrote:
> I have a controller named javascripts and in my view i have few .js.erb
> files.
> on my local machine, i can include the .js as a regular script file and
> it works fine. on my production machine i am not sure how to configure
> nginx that it can recognize both the folders public/javascripts and
> apps/views/javascripts and serve javascripts from both these places.

Use two locations.      

location /public/javascripts { 
    root /someplace/public/javascripts;

location /views/javascripts { 
    proxy_pass; # proxy to rails

Then just refer to the two urls in your templates.



More information about the nginx mailing list