location ~* .(a|b|c)$ {} caused an error
Ian Hobson
hobson42 at gmail.com
Mon Dec 4 17:57:15 UTC 2017
Hi Sophie,
On 04/12/2017 16:49, Sophie Loewenthal wrote:
> Hi,
>
> When I put this location block for case insensitive matching into the vhost produced an error.
>
> nginx: [emerg] location "/" is outside location ".(jpg|jpeg|png|gif|ico|css|js)$" in /etc/nginx/sites-enabled/example.conf:13
>
> My vhost has this:
>
> server {
> …
> location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
> expires 65d;
You need to close the first location here, before opening the second one.
>
> location / {
> allow all;
> limit_req zone=app burst=5;
> limit_rate 64k;
> }
> …
> }
>
> Did I misread the http://nginx.org/en/docs/http/ngx_http_core_module.html#location doxs?
Quite possibly - matching is rather complex.
I have been caught by the order of matching which is NOT the order of
declaration. I need to check it every time I create a configuration.
Regards
Ian
More information about the nginx
mailing list