From e13226914c41ada808aac06967589c5d0acc988a Mon Sep 17 00:00:00 2001 From: Johannes Reppin Date: Wed, 14 Aug 2024 16:43:15 +0200 Subject: [PATCH 1/2] use root-less nginx --- Dockerfile | 5 +++-- scripts/nginx.conf | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5fd4c5dc7..fd0688d19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,9 @@ RUN npm ci COPY . /frontend/ RUN npx ng build -FROM nginx:1.25-alpine +FROM nginx:1.27-alpine RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /frontend/dist/ /usr/share/nginx/html/ COPY scripts/nginx.conf /etc/nginx/nginx.conf -EXPOSE 80 +USER 1000 +EXPOSE 8080 \ No newline at end of file diff --git a/scripts/nginx.conf b/scripts/nginx.conf index 525bde35c..59efbf899 100644 --- a/scripts/nginx.conf +++ b/scripts/nginx.conf @@ -2,10 +2,8 @@ # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ -user nginx; worker_processes auto; -error_log /var/log/nginx/error.log; -pid /run/nginx.pid; +pid /tmp/nginx.pid; # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic. include /usr/share/nginx/modules/*.conf; @@ -18,9 +16,13 @@ http { log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; - - access_log /var/log/nginx/access.log main; - + + client_body_temp_path /tmp/client_temp; + proxy_temp_path /tmp/proxy_temp_path; + fastcgi_temp_path /tmp/fastcgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + scgi_temp_path /tmp/scgi_temp; + sendfile on; tcp_nopush on; tcp_nodelay on; From d966d9af3bd72e675a4d76028c3b76607ca36601 Mon Sep 17 00:00:00 2001 From: Johannes Reppin Date: Thu, 15 Aug 2024 07:08:36 +0200 Subject: [PATCH 2/2] change port in nginx.conf server --- scripts/nginx.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/nginx.conf b/scripts/nginx.conf index 59efbf899..91080400a 100644 --- a/scripts/nginx.conf +++ b/scripts/nginx.conf @@ -33,8 +33,8 @@ http { default_type application/octet-stream; server { - listen 80 default_server; - listen [::]:80 default_server; + listen 8080 default_server; + listen [::]:8080 default_server; server_name _; root /usr/share/nginx/html;