pcre_compile() failed: unrecognized character after (?<

Igor Sysoev igor at sysoev.ru
Fri Dec 11 16:45:50 MSK 2009


On Fri, Dec 11, 2009 at 01:10:33PM +0000, Phillip Oldham wrote:

> server {
>     server_name   ~^test\.(?<domain>.+)$;
> 
>     location / {
>         root  /sites/$domain;
>     }
> }
> 
> # nginx -t
> [emerg]: pcre_compile() failed: unrecognized character after (?< in "^test\.(?<domain>.+)$" at "domain>.+)$" in /etc/nginx/vhosts/testdomain:11
> configuration file /etc/nginx/nginx.conf test failed
> # nginx -V
> nginx version: nginx/0.8.29
> built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
> TLS SNI support disabled
> configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --with-rtsig_module --with-select_module --with-poll_module --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_dav_module --with-http_flv_module --with-http_xslt_module --with-http_random_index_module --with-http_image_filter_module --http-log-path=/var/log/nginx/access.log --with-md5=/usr/lib --with-sha1=/usr/lib --with-http_perl_module
> 
> Can't tell what I'm doing wrong. Advice please?

It seems you have PCRE prior to 7.0, try:

-     server_name   ~^test\.(?<domain>.+)$;
+     server_name   ~^test\.(?P<domain>.+)$;


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list