"[emerg]: pcre_compile() failed: missing terminating ]" in rewrite rule.

Grzegorz Sienko staff at krecio.pl
Thu May 13 01:09:12 MSD 2010


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 :)

-- 
 Best Regards
Grzegorz Sieńko



More information about the nginx mailing list