how to make nginx find my assets that are not in my public/?

Maxim Dounin mdounin at mdounin.ru
Tue Aug 16 22:05:38 UTC 2011


Hello!

On Tue, Aug 16, 2011 at 04:24:26PM -0500, Patrick Aljord wrote:

> On Tue, Aug 16, 2011 at 4:12 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Hello!
> >
> > On Tue, Aug 16, 2011 at 03:47:05PM -0500, Patrick Aljord wrote:
> >
> >> Thanks a lot Maxim, this worked great. This is how my conf looks like
> >> now, not sure if it's perfect yet but for anyone interested:
> >>
> >> http://pastie.org/private/8jat5h9kdagmvtxxzr9pcw
> >
> > You don't need all these if's in "location /", try_files is to
> > replace them all.
> >
> 
> I get this error when I remove those ifs:
> 
> 2011/08/16 16:23:17 [error] 9352#0: *1 directory index of
> "/home/pat/gitreps/shapado/public/" is forbidden, client: 127.0.0.1,
> server: localhost.lan, request: "GET / HTTP/1.1", host:
> "localhost.lan"

Ah, you need directories without index.html to be passed to app 
server as well, right?  Then use

    location / {
        try_files $uri $uri.html $uri/index.html @app;
    }

    location @app {
        proxy_pass http://shapado_app_server;
        proxy_set_header ...
    }

    ...

Maxim Dounin



More information about the nginx mailing list