我正在尝试通过 nginx 为节点应用程序提供服务,但首先尝试为可能位于/public文件夹中的静态文件提供服务。我有那么多工作——但是在访问domain.tld/静态文件夹或索引时,我得到 403;directory index of "/var/www/domain.tld/" is forbidden. 所有权限似乎都正确,所以我很困惑。
这是我的服务器块;
server {
server_name domain.tld;
location / {
root /var/www/domain.tld/public;
try_files $uri $uri/ @proxy;
access_log off;
}
location @proxy {
proxy_pass http://127.0.0.1:3000;
}
}
Run Code Online (Sandbox Code Playgroud)
访问任何随机页面(包括假定的子目录)正确代理节点应用程序。但是,对于任何现有静态目录的根 / 和根,则为 403。
有任何想法吗?