【发布时间】:2021-01-26 15:20:28
【问题描述】:
我正在尝试使用 NGINX 将没有路径的请求(例如 http://example.com/ 或 http://example.com)路由到使用此配置的特定 html 文件(这只是服务器配置中的相关部分):
root $root;
location = / {
index index.html;
alias $root/apps/www/html/main/;
}
如果我仅使用根 url (http://example.com) 导航到该站点,我希望 NGINX 返回 <root>/apps/www/html/main/index.html 但它会忽略确切位置并直接转到根:所有请求都返回错误找不到<root>/index.html。
为了尝试调试它,我尝试使用不同的确切位置路径(例如location = /foo),但这些也被忽略了。我也试过用root代替alias,但也没有成功。
如何重新路由到 NGINX 中的特定位置?
【问题讨论】:
标签: nginx