Answer the question
In order to leave comments, you need to log in
How to setup Nginx config file for React Router Dom?
The SPA uses nested paths for routing: "site.com/dir/page".
With paths like this, Nginx tries to find the file in a subdirectory: "/dir/page".
When looking for a solution, I configured nginx.conf:
events {
}
http {
include mime.types;
server {
listen 80;
root /usr/share/nginx/html;
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question