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

**URL:** <https://www.ruby-forum.com/t/trying-to-get-alias-and-seo-urls-working-with-uwsgi-but-no-luck/203053>\
**Category:** NGINX\
**Created:** [February 11, 2011, 10:55am UTC](https://www.ruby-forum.com/t/trying-to-get-alias-and-seo-urls-working-with-uwsgi-but-no-luck/203053 "2011-02-11T10:55:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [February 11, 2011, 10:55am UTC](https://www.ruby-forum.com/t/trying-to-get-alias-and-seo-urls-working-with-uwsgi-but-no-luck/203053/1 "2011-02-11T10:55:29Z")

</div>

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](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:

```auto
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;
}
```

It’s working fine, as [http://domain.com/shop/](http://domain.com/shop/) finds  
“/public/webshop/main.py” and pass to uwsgi socket. However  
[http://domain.com/shop/product/123](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](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. `
rewrite ^/shop/(.*)$ /$1 permanent;
`  
but with no luck. Maybe I’m so bad at understand nginx rewrite,  
therefore looking for any advice here.

Any thoughts would be appreciated.

/Jesper

Posted at Nginx Forum:

> **[trying to get alias and seo urls working with uwsgi but no luck](https://forum.nginx.org/read.php?2,174087,174087#msg-174087)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![chenxee](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/aca169/32.png) [@chenxee](https://www.ruby-forum.com/u/chenxee)\
**Post date:** [February 11, 2011, 11:16am UTC](https://www.ruby-forum.com/t/trying-to-get-alias-and-seo-urls-working-with-uwsgi-but-no-luck/203053/2 "2011-02-11T11:16:51Z")

</div>

On Fri, Feb 11, 2011 at 04:54:18AM -0500, chenxee wrote:

> uwsgi\_pass unix:$uwsgi\_socket;  
> /public/webshop/main.py and let python script parses url. I have tried  
> googled a lot nginx rewrite rules, e.g. `
> rewrite ^/shop/(.*)$ /$1 permanent;
> `  
> 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 S.

> **[Igor Sysoev](http://sysoev.ru/en/)**
