I'm using the react router dom for my frontend routing, but whenever I refresh the page or access any URL which isn't the root or '/' the server responds with a 404, before I ran npm build the router worked just fine even if I refreshed the page.
Please check React Router BrowserRouter leads to "404 Not Found - nginx " error when going to subpage directly without through a home-page click
https://coderrocketfuel.com/article/fix-404-error-when-using-react-rouder-dom-and-nginx