使用nginx的React路由器抛出404页面找不到

当我们尝试像localhost/page1这样的直接URL时,找不到nginx抛出404页面。

我们正在使用react-router,webpack和nginx。

在我们尝试过的nginx配置中

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

这是我的webpack配置

 devserver: {
    historyApiFallback: true,host : '0.0.0.0'
  },

但没有任何效果, 我在这里想念什么吗?

happy_lele 回答:使用nginx的React路由器抛出404页面找不到

尝试一下


int main(void) {
    int n,i,c,d;
    while(scanf("%d",&n),n!=0){
        c=0;
        int a[n];
        for(i=0; i<n; i++){
        scanf("%ld",&a[i]);
        c=c*10+a[i];
        }
        i=n;
        int b[n];
        while(i>0){
            b[a[i-1]-1]=i;
            --i;
        }
        d=0;
        for(i=0; i<n; i++){
            d=d*10+b[i];
        }
        c==d ? printf("ambiguous\n") : printf("not ambiguous\n");
    }
    return 0;
}
本文链接:https://www.f2er.com/3125603.html

大家都在问