关于nginx location路径匹配问题(看这一篇就够了)

  • Post author:
  • Post category:其他


文档从我的有道云笔记复制过来的,排版有点乱掉,请参考

原文

基本用法
location / {
root html;
try_files $uri $uri/ /index.html;
}
匹配所有“/”开头的路径到html目录下。try_files的含义是:首先会匹配$uri文件,如果没有去匹配$url/文件,如果再没有去找/index.html

扩展用法
location /static/ {