Nginx从任何子文件夹重定向到root index.html

时间:2018-05-02 10:50:25

标签: nginx nginx-location nginx-reverse-proxy

作为子文件夹的任何内容,它将读取domain.com/index.html

与此类似,但在Nginx中 Redirect URL non existent subfolder to root

1 个答案:

答案 0 :(得分:0)

server {

    listen 80;
    listen [::]:80;

    server_name example.com;
    root /apt/website/path;
    index index.html;

    location / {
    try_files $uri $uri/ /index.html;
    }
}