From 8f0331a44270451a3cb43cdfc416614ddb79e14b Mon Sep 17 00:00:00 2001 From: Nivesh Krishna Date: Thu, 9 Feb 2023 18:21:35 +0530 Subject: [PATCH 1/3] mount nginx logs to host --- .env.prod | 1 + docker-compose.prod.yml | 5 ++--- etc/nginx/nginx.conf | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.env.prod b/.env.prod index 9ed4a2762..024b6f172 100644 --- a/.env.prod +++ b/.env.prod @@ -13,3 +13,4 @@ CI_REGISTRY_IMAGE=image SENTRY_DSN=public_key:gitlab.com SENTRY_TRACES_SAMPLE_RATE=1.0 ENVIRONMENT_NAME=prod +LOG_DIRECTORY=/volumes/spot-nginx-log/ diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 21028f8d3..751316518 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -40,9 +40,7 @@ services: ENVIRONMENT_NAME: "${ENVIRONMENT_NAME}" spot-nginx: - image: nginx:1.21 - # container_name: spot-nginx - logging: *default-logging + image: nginx:1.23 restart: always networks: - ${INTERNAL_NETWORK_NAME} @@ -51,6 +49,7 @@ services: - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf - ./etc/nginx/proxy_spot_params:/etc/nginx/proxy_spot_params - ./searx/static:/var/www/spot/static + - ${LOG_DIRECRTORY}:/var/log/nginx filtron: image: dalf/filtron:latest diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index 235b9309d..c02a27f9d 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -2,7 +2,8 @@ user nginx; worker_processes auto; -error_log /var/log/nginx/error.log warn; +access_log /var/log/nginx/access.log main; +error_log /var/log/nginx/error.log main; pid /var/run/nginx.pid; @@ -19,8 +20,6 @@ http { '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$remote_addr"'; - access_log /var/log/nginx/access.log main; - sendfile on; #tcp_nopush on; -- GitLab From 6d58b2c60cd2afa43aa27757c53676e5ed52d99f Mon Sep 17 00:00:00 2001 From: Nivesh Krishna Date: Thu, 9 Feb 2023 18:23:34 +0530 Subject: [PATCH 2/3] fix typo --- docker-compose.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 751316518..e2f9f614a 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -49,7 +49,7 @@ services: - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf - ./etc/nginx/proxy_spot_params:/etc/nginx/proxy_spot_params - ./searx/static:/var/www/spot/static - - ${LOG_DIRECRTORY}:/var/log/nginx + - ${LOG_DIRECTORY}:/var/log/nginx filtron: image: dalf/filtron:latest -- GitLab From 30cbdb3d20410c6154fdf36e53a610825fc642d0 Mon Sep 17 00:00:00 2001 From: Nivesh Krishna Date: Thu, 9 Feb 2023 19:03:54 +0530 Subject: [PATCH 3/3] fix location of log directive --- etc/nginx/nginx.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf index c02a27f9d..d0e73015a 100644 --- a/etc/nginx/nginx.conf +++ b/etc/nginx/nginx.conf @@ -2,8 +2,6 @@ user nginx; worker_processes auto; -access_log /var/log/nginx/access.log main; -error_log /var/log/nginx/error.log main; pid /var/run/nginx.pid; @@ -19,6 +17,9 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$remote_addr"'; + + access_log /var/log/nginx/access.log main; + error_log /var/log/nginx/error.log warn; sendfile on; #tcp_nopush on; -- GitLab