nginx如何重写位置

nginx如何重写位置,nginx,Nginx,我想要->, 如何编写我的位置配置 这是我的位置,但不起作用 location ^~ /health { root /usr/share/nginx/html; index health.html ; } location / { root /usr/share/nginx/html; index index.html index.htm; } 谢谢您的帮助。使用重写指令 location / { root /usr/share/ng

我想要->, 如何编写我的位置配置

这是我的位置,但不起作用

location ^~  /health {
    root   /usr/share/nginx/html;
    index  health.html ;
}

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

谢谢您的帮助。

使用
重写
指令

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;

    rewrite ^/heath/?$ /health.html? break;
}
资料来源: