diff --git a/Dockerfile b/Dockerfile index 17f3cbd..221d9c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN npm run build # Step 2: Serve the app using NGINX FROM nginxinc/nginx-unprivileged:mainline +COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=build /usr/src/app/dist /usr/share/nginx/html EXPOSE 8080 CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..3bc9b47 --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,27 @@ +server { + listen 8080; + server_name localhost; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # react app specific + location / { + if (!-e $request_filename){ + rewrite ^(.*)$ /index.html break; + } + } +} \ No newline at end of file