好的,问题是
root
指令,路径为
连接的
server {
listen 80;
listen [::]:80;
server_name <server IP>;
root /some/path/to/project/static-files;
index index.html;
location /projectname {
try_files $uri $uri/ =404;
}
location / {
root /var/www/html;
index index.nginx-debian.html;
}
}
nginx试图发球
/projectname
/some/path/to/project/static-files/projectname
/some/path/to/project/static-files
). 我需要的是
alias
指令:
server {
listen 80;
listen [::]:80;
server_name <server IP>;
index index.html;
location /projectname {
alias /some/path/to/project/static-files;
index index.html;
}
location / {
root /var/www/html;
index index.nginx-debian.html;
}
}
try_files
工作,所以我现在删除了它,还添加了
index
指令。