如何在不将其下载到 nginx 的情况下从 url 重定向到 html 文件

Nur*_*jan 0 url nginx redirect

我需要将 url 重定向到位于文件系统上的 html 文件。这是我迄今为止尝试过的:

location /this/some/url {
    alias /path/to/the/file.html
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,重定向工作但浏览器尝试下载 html 文件。相反,我希望它在浏览器中呈现 html 页面。

Ale*_*nko 5

location /this/some/url {
    index file.html;
    alias /path/to/the/;
}
Run Code Online (Sandbox Code Playgroud)

请阅读别名:https : //nginx.ru/en/docs/http/ngx_http_core_module.html#alias

关于索引文件:https : //nginx.ru/en/docs/http/ngx_http_index_module.html

一切都变得清晰起来。