Location url start with modifier, nginx -t pass the configuration test

linbo liao llbgurs at gmail.com
Sat Feb 11 13:38:38 UTC 2017


Thank you for the clarification.

2017-02-10 20:45 GMT+08:00 Maxim Dounin <mdounin at mdounin.ru>:

> Hello!
>
> On Fri, Feb 10, 2017 at 01:31:34PM +0800, linbo liao wrote:
>
> > I setup an test Nginx 1.10.3 on local VM (Centos 6.7 x86_64). I configure
> > the following location
> >
> > location =/404.html {
> >     root    /usr/share/nginx/html;
> > }
> >
> > As my understanding, it is not an valid url, but `nginx -t`  pass the
> > configuration test.
> >
> > Is it a bug ?
>
> In this particular case the location is interpreted as "/404.html"
> with "=" modifier (see http://nginx.org/r/location).  That is, it
> matches requests to "/404.html" exactly.  Space between "=" and
> "/404.html" can be omitted, and nginx is smart enough to recognize
> this.
>
> On the other hand, there are no limitations on locations to
> configure in nginx.conf.  You can configure anything you like,
> even locations which can't match real URIs.  Moreover, such
> locations can used for artificial processing with rewrites, and
> I've seen such configs in practice.  This is not something I can
> recommend though.
>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170211/b34b2129/attachment.html>


More information about the nginx mailing list