nginx对不存在的文件进行404处理

    
location / {
    try_files $uri $uri/ /?$args 404;                
}

location / {
  try_files $uri $uri/ /index.html 404;
}

这句话的意思就是查找文件$uri是否存在,如果不存在就查找文件夹$uri/是否存在,如果不存在就执行最后一个参数/?$args,这个打开肯定就是设置的默认index文件了

  

原文地址:https://www.cnblogs.com/shansongxian/p/10845203.html