Hi.
I’m trying to do some rewrite. My url is:
http://domain.tld/stream/file/{username}{crc_username}{hash-file}.{extension}
and I’m want it to rewrite it to different location, where files
physically are.
location ^~ /stream/file/ {
rewrite
“([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(.[^./\]*)$?”
/files/$1.$2/$3$4 last;
alias /home/resources/upload/;
mp4;
}
and while testing configuration I got error:
[emerg]: pcre_compile() failed: missing terminating ] for character
class in “([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(.[^./]*)$?”
And I don’t see why I missed one ] ? When I add ] to the end I got
error: pcre_compile() failed: missing terminating ).
Any help appreciate
Hi
Thanks Maxim, everything work like a charm now
–
Best Regards
Grzegorz
Sieñko
2010/5/12 Maxim D. [email protected]:
Hello!
On Wed, May 12, 2010 at 11:09:12PM +0200, Grzegorz S. wrote:
Hi.
I’m trying to do some rewrite. My url is:
http://domain.tld/stream/file/{username}{crc_username}{hash-file}.{extension}
and I’m want it to rewrite it to different location, where files physically are.
location ^~ /stream/file/ {
rewrite
“([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(.[^./\]*)$?”
- “([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(.[^./\]*)$?”
- “([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(\.[^./\\]*)?$”
nginx uses '' as escape character in it’s config syntax, and it
should be doubled if you want to pass it literally.
(and you don’t need '' before ‘.’ in character group; and don’t
need '' before ‘/’; and ‘?’ can’t follow ‘$’)
[…]
and while testing configuration I got error:
[emerg]: pcre_compile() failed: missing terminating ] for character
class in “([a-f0-9]{8})([a-f0-9]{8})([a-f0-9]{40})(.[^./]*)$?”
And I don’t see why I missed one ] ? When I add ] to the end I got
error: pcre_compile() failed: missing terminating ).
Regexp printed in error message is a hint.
Maxim D.