Problems with some rewrite

revirii nginx-forum at nginx.us
Tue Aug 24 16:52:55 MSD 2010


Igor Sysoev Wrote:
-------------------------------------------------------
> You DO need the locations, but you DO NOT need the
> rewrites.

ok.

> Why do you use space in "([0-9] {2}" ?

Because space was used here:
http://wiki.nginx.org/NginxHttpRewriteModule#rewrite

> Here is example for 2 numbers location:
> 
>      # 2 numbers
>      location ~ ^/img/default/-?(\d{2})/.+\.(.+)$
> {
>          alias
> /home/images/public/$1x/xxx/$1/default.$2;
>      }

Hm, what is \d{2}? Is there any documentation? And:

[code]
nginx -t
2010/08/24 14:40:25 [emerg] 7386#0: pcre_compile() failed: missing ) in
"^/img/default/-?(\d"
2010/08/24 14:40:25 [emerg] 7386#0: the configuration file
/etc/nginx/nginx.conf test failed
[/code]

I put it into "...": 

[code]
location ~ "^/img/default/-?(\d{2})/.+\.(.+)$"
[/code]

But then i see:

[code]
2010/08/24 14:48:34 [emerg] 7449#0: the "alias" directive may not be
used inside location given by regular expression
2010/08/24 14:48:34 [emerg] 7449#0: the configuration file
/etc/nginx/nginx.conf test failed
[/code]

Whats wrong now?

Thx in advance

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,123057,123113#msg-123113




More information about the nginx mailing list