Reactjs 当我在url中指定页面时,React Router返回404

Reactjs 当我在url中指定页面时,React Router返回404,reactjs,nginx,react-router,Reactjs,Nginx,React Router,当我进入mywebsite.com时,我会看到我的网站。然而,当我访问mywebsite.com/page时,我会得到一个404 我正在使用nginx交付文件,从我所读到的内容来看,我已经将其配置为始终转到索引,但它似乎不起作用 这是我的nginx配置: server { listen 80 default_server; server_name mywebsite.com; root /var/www/mywebsite.com/frontend/build;

当我进入mywebsite.com时,我会看到我的网站。然而,当我访问mywebsite.com/page时,我会得到一个404

我正在使用nginx交付文件,从我所读到的内容来看,我已经将其配置为始终转到索引,但它似乎不起作用

这是我的nginx配置:

server {
    listen 80 default_server;
    server_name mywebsite.com;

    root /var/www/mywebsite.com/frontend/build;
    index index.html index.htm;

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

server {
    listen 80;
    listen [::]:80 ipv6only=on;

    root /var/www/mywebsite.com/backend/public;
    index index.php index.html index.htm;

    server_name api.mywebsite.com;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}


我如何让nginx使用react路由器?

看看这个,这是我检查过的,似乎有他们推荐的想法:
try\u files$uri$uri//index.html啊,是的,我忘记index.html之前的“/”了!谢谢