diff --git a/Dockerfile b/Dockerfile index 4a625a3..ef7c96b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,3 +16,4 @@ RUN make build-gui-deploy # Copy all compiled content into simple http server container FROM nginx COPY --from=build /src/dist/ /usr/share/nginx/html/ +COPY misc/default.conf /etc/nginx/conf.d/default.conf diff --git a/misc/default.conf b/misc/default.conf new file mode 100644 index 0000000..3e438fc --- /dev/null +++ b/misc/default.conf @@ -0,0 +1,24 @@ +server { + listen 80; + listen [::]:80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } + + # make static files return proper 404 if not found instead of falling back on index.html + # and apply some caching + location ~* \.(webmanifest|xml|html|jpeg|jpg|gif|png|svg|ico)$ { + expires 1d; + root /usr/share/nginx/html; + } + + # make static files return proper 404 if not found instead of falling back on index.html + # and apply heavy caching because these files should be hashed anyways + location ~* \.(js|css)$ { + expires 1y; + root /usr/share/nginx/html; + } +}