Regular expressions in server_name: pattern length
Phillip Oldham
phill at activityhq.com
Wed Dec 9 17:05:21 MSK 2009
Igor Sysoev wrote:
> On Wed, Dec 09, 2009 at 10:21:11AM +0000, Phillip Oldham wrote:
>
>> Igor Sysoev wrote:
>>
>>> It's possible:
>>>
>>> server {
>>> server_name ~^([a-z]{2,3})?\d{3,6}\.mysite\.org$;
>>> }
>>>
>>> server {
>>> server_name ~^(\w+)\.mysite\.org$;
>>> }
>>>
>>>
>> Is this with the latest devel, or stable?
>>
>
> regex as a main server_name supported since 0.6.25.
> server_name captures can be used since 0.7.40.
> Named server_name captures can be used since 0.8.25.
>
Sorry, I must be doing something wrong but can't see where:
server {
server_name ~^([a-z]{2,3})?\d{3,6}\.mysite\.org$;
...
}
# nginx -t
[emerg]: directive "server_name" is not terminated by ";" in
/etc/nginx/vhosts/mysite.org:7
configuration file /etc/nginx/nginx.conf test failed
# nginx -V
nginx version: nginx/0.7.62
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
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
More information about the nginx
mailing list