Nginx location指令匹配顺序规则

问题:nginx配置图片转发代理,不生效,提示404

描述:nginx配置文件中添加了localhost->root为本地地址,匹配设置为 location ~ .*.(gif|jpg|jpeg|png)$

解决:配置前添加 "^~";

location ^~ /images/ {
  # 匹配任何以 /images/ 开始的查询并且停止搜索,不检查正则表达式。
  [ configuration C ]
}

 参考博客:

 nginx配置访问图片路径以及html静态页面的调取方法 

    nginx(四)location正则表达式使用

原文地址:https://www.cnblogs.com/chenking/p/11686118.html