diff --git a/Dockerfile b/Dockerfile index 606e4e72ac9caee0e5f60ad6cb86bf6c4f4adb82..c700106942ae2c086aef81291e1571d412baa68b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,9 @@ RUN npm run build:prod # Stage 1, based on Nginx, to have only the compiled app FROM ${DEPENDENCY_PROXY}nginxinc/nginx-unprivileged:1.25 +# Copy custom conf to write logs into file to persist them COPY nginx/nginx.conf /etc/nginx/nginx.conf +RUN mkdir -p /var/log/nginx/persist # Copy nginx modified conf with template (cf. "Using environment variables in nginx configuration" in https://hub.docker.com/_/nginx ) COPY nginx/templates/default.conf.template /etc/nginx/templates/default.conf.template diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 1b97c544223ce0c09c3ac23f50cc157bf429caca..7c6dadaf7c35b0c92dc6bb1b517a63a87bacc055 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -26,7 +26,7 @@ http { # Default log which is redirected to stdout access_log /var/log/nginx/access.log main; # Also write to file to persist logs - access_log /var/log/nginx/persist/access.$time_local.log main; + access_log /var/log/nginx/persist/access.$year-$month-$day.log main; sendfile on; #tcp_nopush on;