nginx rewirte try_files

By 水木神風 at 2021-01-14 • 0人收藏 • 1183人看过

        location / {

            root   /usr/local/kunheng/kunheng-web/hongji;

try_files $uri $uri/ @router;

            index  index.html index.htm;


#主播详情

rewrite ^(.*)/anchor/tb(\d+)/(\d+)$ http://192.168.2.43:9999/hongji/#/hj/anchorDetail/foundation?anchorId=$2&ancInfoId=$3&platformType=1 break;

rewrite ^(.*)/anchor/dy(\d+)/(\d+)$ http://192.168.2.43:9999/hongji/#/hj/anchorDetail/foundation?anchorId=$2&ancInfoId=$3&platformType=2 break;

rewrite ^(.*)/anchor/ks(\d+)/(\d+)$ http://192.168.2.43:9999/hongji/#/hj/anchorDetail/foundation?anchorId=$2&ancInfoId=$3&platformType=3 break;

#商品详情

rewrite ^(.*)/goods/(\d+)/(\d+)$ http://192.168.2.43:9999/hongji/#/hj/goodsDetail?goodsId=$2&id=$3 break;

#商家详情

rewrite ^(.*)/merchant/(\d+)/(\d+)$ http://192.168.2.43:9999/hongji/#/hj/businessDetail?id=$2&tenantId=$3 break;


        }

location @router {

rewrite ^.*$ /index.html last;

}


登录后方可回帖