Answer the question
In order to leave comments, you need to log in
How to set rules in nginx location for all folders except one and its subfolders?
I want to set cache-control on images from the server, except for those that are in the /forum folder and its subfolders. The global rule looks like this:
location ~* \.(?:jpg|jpeg|gif)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
~* ^/forum/.*\.(?:jpg|jpeg)$
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question