Friday, 23 August 2013

Nginx match multiple paths in location directive

Nginx match multiple paths in location directive

I have the following directives in my nginx conf, that are working correctly:
location = /favicon.ico {
root /home/www/myapp/static/ico;
}
location ^~ /apple-touch-icon {
root /home/www/myapp/static/ico;
}
I would to merge those expression in one directive but I cant figure out
how to correctly build the regex. I tried the following but it works only
for favicon.ico and I get 404 requesting /apple-touch-icon-precomposed.png
location ~* ^/(apple-touch-icon(.)*\.png|favicon.ico) {
root /home/www/myapp/static/ico;
}
It is a problem of what is matched I think.

No comments:

Post a Comment