diff --git a/Dockerfile b/Dockerfile index 7efbf03..fd7fa90 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,5 +8,6 @@ RUN npm run build FROM nginx:alpine COPY nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/out /usr/share/nginx/html +RUN rm -f /usr/share/nginx/html/*.txt EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx.conf b/nginx.conf index b582317..c939c45 100644 --- a/nginx.conf +++ b/nginx.conf @@ -17,7 +17,11 @@ server { add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; - # Handle Next.js static export routes + # Serve index.html for root and all routes (SPA fallback) + location = / { + try_files /index.html =404; + } + location / { try_files $uri $uri.html $uri/index.html /index.html; }