Welcome! Log In Create A New Profile

Advanced

Re: trying to get alias and seo urls working with uwsgi but no luck

February 11, 2011 05:18AM
On Fri, Feb 11, 2011 at 04:54:18AM -0500, chenxee wrote:
> hi there,
>
> I'm new to nginx and trying to configure nginx and uwsgi to get
> alias+seo url working, something like this:
>
> http://domain.com/shop/product/123 - /shop is an alias and shop dir
> doesnt exist in filesystem under doc root, and this url trying to pass
> query string as ?product=123
>
> to get alias working, my config:
>
> [code]
> location /shop {
> alias /public/webshop;
> index main.py;
> }
>
> location ~ ^/shop.+\.py$ {
> root /public/webshop;
> rewrite /shop/(.*\.py?)$ /$1 break;
> include uwsgi_params;
> uwsgi_pass unix:$uwsgi_socket;
> }
> [/code]
>
> It's working fine, as http://domain.com/shop/ finds
> "/public/webshop/main.py" and pass to uwsgi socket. However
> http://domain.com/shop/product/123 always report 404 not found - nginx
> tries to locate "/public/webshop/product/123" and ofc it's not there..
> whereas http://homer.unisport.dk/shop/?product=123 works fine as usual.
>
> What I'm trying is to forward all request starting with /shop to
> /public/webshop/main.py and let python script parses url. I have tried
> googled a lot nginx rewrite rules, e.g. [code]
> rewrite ^/shop/(.*)$ /$1 permanent;
> [/code]
> but with no luck. Maybe I'm so bad at understand nginx rewrite,
> therefore looking for any advice here.
>
> Any thoughts would be appreciated.

You need to make copy of uwsgi_params, say, uwsgi.conf,
Then remove this line from the new file:
uwsgi_param PATH_INFO $document_uri;

and use this configuraiton:

location /shop {
uwsgi_pass unix:/path/to/uwsgi/socket;
include uwsgi.conf;
uwsgi_param PATH_INFO /public/webshop/main.py;
}

Alos, you should not
set $uwsgi_socket /path/to/uwsgi/socket;


--
Igor Sysoev
http://sysoev.ru/en/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

trying to get alias and seo urls working with uwsgi but no luck

chenxee February 11, 2011 04:54AM

Re: trying to get alias and seo urls working with uwsgi but no luck

Igor Sysoev February 11, 2011 05:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 247
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready