location ~* .(a|b|c)$ {} caused an error

Sophie Loewenthal sophie at klunky.co.uk
Mon Dec 4 18:14:45 UTC 2017


Oh. the closing }

It’s been a long day     <:-I


> On 4 Dec 2017, at 18:57, Ian Hobson <hobson42 at gmail.com> wrote:
> 
> 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
> _______________________________________________
> 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/20171204/55c37514/attachment.html>


More information about the nginx mailing list