From 854c5d5bae81c7e16f1695b5fcd1f9cc28ab1ed5 Mon Sep 17 00:00:00 2001 From: Shahan Neda Date: Thu, 7 Jul 2022 19:52:43 -0400 Subject: [PATCH] Fix Staging server 404 error (#22) --- Dockerfile | 3 +++ next.config.js | 1 + staging-nginx.conf | 10 ++++++++++ 3 files changed, 14 insertions(+) create mode 100644 staging-nginx.conf diff --git a/Dockerfile b/Dockerfile index dfb0893..e0c32c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,2 +1,5 @@ FROM nginx COPY ./out /usr/share/nginx/html + +COPY staging-nginx.conf /etc/nginx/conf.d +RUN rm /etc/nginx/conf.d/default.conf \ No newline at end of file diff --git a/next.config.js b/next.config.js index a843cbe..0128f08 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + trailingSlash: true, } module.exports = nextConfig diff --git a/staging-nginx.conf b/staging-nginx.conf new file mode 100644 index 0000000..4e05092 --- /dev/null +++ b/staging-nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ $uri.html $uri.html/ /index.html; + } + error_page 404 /index.html; + } + \ No newline at end of file