Regular expressions in server_name: pattern length
Igor Sysoev
igor at sysoev.ru
Wed Dec 9 17:16:29 MSK 2009
On Wed, Dec 09, 2009 at 02:05:21PM +0000, Phillip Oldham wrote:
> 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
This is caused by "{":
- server_name ~^([a-z]{2,3})?\d{3,6}\.mysite\.org$;
+ server_name "~^([a-z]{2,3})?\d{3,6}\.mysite\.org$";
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list