diff --git a/Dockerfile b/Dockerfile index 61adae9..9191172 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,6 +38,9 @@ LABEL stage="nginx-server" # Copy the build output from the 'build' stage to Nginx's html directory COPY --from=build /app/build /usr/share/nginx/html +# Replace default nginx config with one that handles SPA client-side routing +COPY nginx-docker.conf /etc/nginx/conf.d/default.conf + # Expose port 80 (Nginx default) EXPOSE 80 diff --git a/nginx-docker.conf b/nginx-docker.conf new file mode 100644 index 0000000..f749e02 --- /dev/null +++ b/nginx-docker.conf @@ -0,0 +1,9 @@ +server { + listen 80; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +}