I have the following rule in my nginx config:

location ~* .(js|css|png|jpg|jpeg|gif|ico|xml|swf|flv|eot|ttf|woff|pdf|xls|htc)$ {

which matches some images and other resources. However I want to prevent it to match resources which are in a specific directory uploads. How would I change the above rule to prevent matching files in the uploads directory (like /uploads/something.jpg), but still match file like /anything/whatever.jpg or just whatever.jpg?


location ~* ^\/(?!(upload\/)).*(js|css|png|blahblah)$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.