为什么 nginx 复制路径中的文件夹

Why is nginx duplicating the folder in the path

我正在尝试使用 Nginx 配置 Adminer。这是我的 adminer.conf:

server {
  listen 80;
  
  location /adminer {
    root /usr/share/webapps/adminer;
    index index.php;
  }
}

但是,当我转到 localhost/adminer 时,出现错误 /usr/share/webapps/adminer/adminer/index.php is not found (No such file or directory)

adminer文件夹重复了,不知道为什么。该位置应解析为 /usr/share/webapps/adminer/index.php.

位置应该是

  • / 来自 /usr/share/webapps/adminer 对于 localhost
  • /adminer 来自 /usr/share/webapps 对于 localhost/adminer
server {
  listen 80;
  
  location /adminer {
    root /usr/share/webapps/;
    index index.php;
  }
}