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 · 1924 views
    This topic created in 2230 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
        1
    rrfeng  
       Apr 28, 2020
    rewrite /index.html / break;
    cloverzrg2
        2
    cloverzrg2  
       Apr 28, 2020
    server {
    ...
    location /index.html {
    return 301 https://$server_name/;
    }
    }
    cloverzrg2
        3
    cloverzrg2  
       Apr 28, 2020
    ```
    server {
    ...
    location /index.html {
    return 302 https://$server_name/;
    }
    }
    ```
    lvming6816077
        4
    lvming6816077  
    OP
       Apr 28, 2020
    十分感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1256 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 17:40 · PVG 01:40 · LAX 10:40 · JFK 13:40
    ♥ Do have faith in what you're doing.