jan*_*rau 4 linux host nginx server
我想从文件夹/var/www/fileUpload/html 中调用index.html。该文件夹中存在index.html 文件。
/ 路由器工作。uploadFiles 路由也是如此。但是当我打开上传路由时,出现 404 错误。
server{
listen 80;
server_name xx.xx.xxx.xxx;
location / {
root /var/www/kioskJPE/html;
index index.html;
}
location /upload {
root /var/www/fileUpload/html;
index index.html;
}
location /uploadFiles {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Run Code Online (Sandbox Code Playgroud)
你有什么建议吗?谢谢你!
那应该是alias /var/www/fileUpload/html;
,否则 Nginx 正在寻找/var/www/fileUpload/html/upload/index.html
. 有关详细信息,请参阅此文档。
例如:
location /upload {
alias /var/www/fileUpload/html;
}
Run Code Online (Sandbox Code Playgroud)