From 68df7076c136d6874ac502182881c294071f99ca Mon Sep 17 00:00:00 2001 From: Daniel Savosin Date: Sun, 8 Sep 2024 16:02:42 +0700 Subject: [PATCH] [docker] allow use path prefix --- Dockerfile | 2 ++ templates/default.conf.template | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index acea170..348c00d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ ARG NGINX_VERSION=1.27.1 FROM nginx:${NGINX_VERSION}-alpine +ENV LINK_PREFIX="" + COPY css /opt/litterlink/css COPY fonts /opt/litterlink/fonts COPY images /opt/litterlink/images diff --git a/templates/default.conf.template b/templates/default.conf.template index 0a972b7..f3fb22d 100644 --- a/templates/default.conf.template +++ b/templates/default.conf.template @@ -1,8 +1,8 @@ server { listen 80; - - location / { - root /opt/litterlink; - index index.html; + + location ~ ^$LINK_PREFIX/$ { + root /opt/litterlink/; + try_files /index.html =404; } }