› NGINX
› NGINX Trac
› 3rd Party Modules
› Security Advisories
› CHANGES
› OpenResty
› ngx_lua
› Tengine
在线学习资源
› NGINX 开发从入门到精通
NGINX Modules
› ngx_echo
lvming6816077
V2EX  ›  NGINX

nginx 配置求助

  •  
  •   lvming6816077 · Apr 28, 2020 · 2216 views
    This topic created in 2382 days ago, the information mentioned may be changed or developed.

    原本业务的页面时 http://www.abc.com/index.html 是一个纯静态服务,目录下也有 index.html 这个文件

    但是后面将此服务改成了服务端渲染,服务端的第一个路由是 /

    请问,如何通过 nginx 配置将原本的 http://www.abc.com/index.html 全部转发到 http://www.abc.com/

    4 replies  •  2020-04-28 14:51:17 +08:00
    rrfeng
    rrfeng
    Apr 28, 2020
    1
    rewrite /index.html / break;
    cloverzrg2
    cloverzrg2
    Apr 28, 2020
    2
    server {
    ...
    location /index.html {
    return 301 https://$server_name/;
    }
    }
    cloverzrg2
    cloverzrg2
    Apr 28, 2020
    3
    ```
    server {
    ...
    location /index.html {
    return 302 https://$server_name/;
    }
    }
    ```
    lvming6816077
    lvming6816077
    OP
    Apr 28, 2020
    4
    十分感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1315 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:19 · PVG 03:19 · LAX 11:19 · JFK 14:19
    ♥ Do have faith in what you're doing.