【发布时间】:2020-10-07 08:26:40
【问题描述】:
我已将 nginx 配置为提供静态页面,如下所示。
location /home {
alias /home/username/files/home;
try_files $uri /home/index.html;
}
http://example.com/home 上仅加载 index.html。所有其他 css、js 和图像文件都得到 404,因为请求仍然是 http://example.com/css/style.css 而不是 http://example.com/home/css/style.css。有什么方法可以为所有静态文件配置/home前缀,而无需手动添加到所有静态文件中?
【问题讨论】:
-
在答案中添加了重要说明,请查看答案编辑历史记录。
标签: nginx