matching on server_name was: (Issue with variables in access_log and error_log)

Igor Sysoev is at rambler-co.ru
Thu Jul 30 20:47:16 MSD 2009


On Thu, Jul 30, 2009 at 06:10:30PM +0200, Dale Gallagher wrote:

> Thanks for the responses.
> However, a new issue has surfaced, hence the subject change ...
> 
> 2009/7/29 Igor Sysoev <is at rambler-co.ru>:
> > Since 0.7.44 you may use
> >
> >      server_name  ~^(w{3}\.)?(.*)$;
> >      set   $domain  $2;
> 
> Unfortunately, on start-up, nginx exits with the error:
> 
>   [emerg]: directive "server_name" is not terminated by ";"
> 
> Yes, I did double-check that the trailing ; existed.

Yes, this is because of "{" in regex. nginx treats this like

   server_name ~^(w {

> So, I then tried:
> 
>   server_name ~ "^(w{3}\.)?(.*)$";

This is right way.

> which didn't cause nginx to exit, but all requests result in:
> 
>   502 Bad Gateway
> 
> Any ideas as to what might be wrong with the suggested config?

What is in error_log ?


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





More information about the nginx mailing list