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

Sophie Loewenthal sophie at klunky.co.uk
Mon Dec 4 16:49:45 UTC 2017


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;

        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?

Quote "A location can either be defined by a prefix string, or by a regular expression. Regular expressions are specified with the preceding “~*” modifier (for case-insensitive matching),"

Thanks, Sophie.

More information about the nginx mailing list