Nginx Map Multiple Parameter Input

Igor Sysoev igor at sysoev.ru
Fri Oct 12 14:43:47 UTC 2012


On Oct 12, 2012, at 18:37 , rahul286 wrote:

> Sorry for wrong question. I wanted to ask...
> 
> map "~ ^/~([^/]*)/.*$)" $userhome{
> } 
> 
> style regex. Where map input  string will be $1.

No. "map" is not "location". 

> ===
> 
> Apart from that, inside map:
> 
> map $uri $blogname{
>       ~^(?P<blogpath>/[^/]+/)files/(.*)$      $blogpath ;
> }
> 
> I am not able to use $1. I always have to use a variable like $blogpath. Is
> it by design or a mistake on my end?
> 
> I get error: "nginx: [emerg] unknown "1" variable" when I try:
> 
> map $uri $blogname{
>       ~^(/[^/]+/)files/(.*)$      $1 ;
> }

Digit captures are not supported in map. You have to use named capture.


--
Igor Sysoev
http://nginx.com/support.html



More information about the nginx mailing list