I have an app which is using React router, and I created a docker image for it. I am using nginx server and it works. But, refreshing a page gives me nginx 404 error. I know that I need to overwrite nginx config file to make it work, but don't know why it doesn't work.
I tried to add some kind of redirect to nginx.conf
just to see if it overrides default.conf
but it doesn't work. These are my files:
Dockerfile:
FROM nginx:alpine
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
nginx.conf
server {
listen 80 default;
server_name localhost;
return 301 https://www.google.com;
}
EDIT:
And how to check what config file is running?