0%

前端三种路由配置

前端三种路由配置

  • 第一种

    1
    2
    3
    4
    5
    location /anti-fraud {
    alias /opt/welab/anti-fraud;
    index index.html index.htm;
    error_page 404 /anti-fraud/index.html;
    }
  • 第二种

    1
    2
    3
    4
    5
    location /financial-life {
    rewrite /financial-life/(.+) /$1 break;
    root /opt/welab/financial-life;
    index index.html index.htm;
    }
  • 第三种

    1
    2
    3
    4
    5
    location /sjd {
    alias /opt/welab/sjd;
    index index.html index.htm;
    try_files $uri /sjd/login /sjd/main.html;
    }

跨域配置

1
2
3
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers content-type,x-user-token;
add_header Access-Control-Allow-Methods GET,POST;