From 2157f9a322abb1ad43934da3154524f42ce33b21 Mon Sep 17 00:00:00 2001 From: Ajay Bura <32841439+ajbura@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:21:03 +0530 Subject: [PATCH] add ngnix conf file for docker build (#1837) --- Dockerfile | 1 + contrib/nginx/cinny.domain.tld.conf | 15 +++++++++++---- docker-nginx.conf | 16 ++++++++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 docker-nginx.conf diff --git a/Dockerfile b/Dockerfile index d6fffee..58e5ba7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN npm run build FROM nginx:1.27.0-alpine COPY --from=builder /src/dist /app +COPY --from=builder /src/docker-nginx.conf /etc/nginx/conf.d/default.conf RUN rm -rf /usr/share/nginx/html \ && ln -s /app /usr/share/nginx/html diff --git a/contrib/nginx/cinny.domain.tld.conf b/contrib/nginx/cinny.domain.tld.conf index b735de1..360302c 100644 --- a/contrib/nginx/cinny.domain.tld.conf +++ b/contrib/nginx/cinny.domain.tld.conf @@ -19,9 +19,16 @@ server { location / { root /opt/cinny/dist/; - index index.html; - } - location ~* ^\/(login|register) { - try_files $uri $uri/ /index.html; + + rewrite ^/config.json$ /config.json break; + rewrite ^/manifest.json$ /manifest.json break; + + rewrite ^.*/olm.wasm$ /olm.wasm break; + rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break; + + rewrite ^/public/(.*)$ /public/$1 break; + rewrite ^/assets/(.*)$ /assets/$1 break; + + rewrite ^(.+)$ /index.html break; } } diff --git a/docker-nginx.conf b/docker-nginx.conf new file mode 100644 index 0000000..6994b8c --- /dev/null +++ b/docker-nginx.conf @@ -0,0 +1,16 @@ +server { + location / { + root /usr/share/nginx/html; + + rewrite ^/config.json$ /config.json break; + rewrite ^/manifest.json$ /manifest.json break; + + rewrite ^.*/olm.wasm$ /olm.wasm break; + rewrite ^/pdf.worker.min.js$ /pdf.worker.min.js break; + + rewrite ^/public/(.*)$ /public/$1 break; + rewrite ^/assets/(.*)$ /assets/$1 break; + + rewrite ^(.+)$ /index.html break; + } +} \ No newline at end of file