[prev in list] [next in list] [prev in thread] [next in thread] 

List:       uwsgi
Subject:    [uWSGI] how to route under nginx+uwsgi?
From:       roberto () unbit ! it (Roberto De Ioris)
Date:       2011-07-03 10:02:01
Message-ID: 9e39fe44f1eb03fd0eb0dfdd520d7e5b.squirrel () manage ! unbit ! it
[Download RAW message or body]


> I encountered a problem of request routing.
>
> In my nginx, I route all requests to port 8091
>         location / {
>             include uwsgi_params;
>             uwsgi_pass 127.0.0.1:8091;
>         }
>
> I serve 8091 with uwsgi, and am trying to write a router.py on it.
> But I found all requests were routed to router.py, including all static
> requests, such as xx.jpg, favicon.ico.
>
> I just want to serve cgi requests, not static resource requests in my
> router.py.
> How to do it?


You can define a location stanza for each "static dir"

location /images {
                ...
        }

location \.jpg$ {
                ...
        }

location / {
             include uwsgi_params;
             uwsgi_pass 127.0.0.1:8091;
         }


Or you can use the try_files directive:

http://wiki.nginx.org/HttpCoreModule#try_files

-- 
Roberto De Ioris
http://unbit.it

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic