diff --git a/Dockerfile b/Dockerfile index e7d4bc5fa..119a06612 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,3 +28,4 @@ RUN yarn run build-docker FROM nginx:alpine COPY --from=build /usr/src/app/build /usr/share/nginx/html +COPY --from=build /usr/src/app/deploy/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/deploy/nginx.conf b/deploy/nginx.conf new file mode 100644 index 000000000..a23a34ba2 --- /dev/null +++ b/deploy/nginx.conf @@ -0,0 +1,43 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + + ## Your only path reference. + root /usr/share/nginx/html; + + ## This should be in your http block and if it is, it's not needed here. + index index.html; + + autoindex off; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /manifest.json { + allow all; + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location / { + if (!-e $request_filename){ + rewrite ^(.*)$ /index.html break; + } + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; + } + +}