Regular expressions in server_name: pattern length

Michael Shadle mike503 at
Fri Feb 5 01:59:38 MSK 2010

2010/2/4 Maxim Dounin <mdounin at>:

> Either upgrade pcre library to 7.0 at least, or use (?P<...>)
> syntax as available from pcre version 4.0.

I'm under the hassle of Redhat :/

I did try this instead

server_name ~^(.+)\.domain\.com$;
rewrite ^$1 permanent;

$1 isn't being populated. Of course, I guess $1 would be usually a
regex match for the rewrite line. How can I pass the match from
server_name down to rewrite?

More information about the nginx mailing list