“vinit5112” commited on
Commit
99de5ef
·
1 Parent(s): 5eb5663

fix: override nginx global config to prevent log path error

Browse files
Files changed (2) hide show
  1. Dockerfile +7 -4
  2. frontend/nginx.global.conf +24 -0
Dockerfile CHANGED
@@ -31,16 +31,19 @@ COPY --from=frontend-build /app/frontend/build /app/frontend_build
31
  # Install nginx
32
  RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
33
 
34
- # Copy nginx config
 
 
 
35
  COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
36
 
37
  # Link built frontend to nginx root
38
  RUN rm -rf /usr/share/nginx/html && \
39
  ln -s /app/frontend_build /usr/share/nginx/html
40
 
41
- # Create writable temp dirs for nginx to avoid permission error
42
- RUN mkdir -p /app/tmp/body /app/tmp/proxy /app/tmp/fastcgi /app/tmp/uwsgi /app/tmp/scgi && \
43
- chmod -R 777 /app/tmp
44
 
45
  # Create log directory for NGINX
46
  RUN mkdir -p /app/logs && chmod -R 777 /app/logs
 
31
  # Install nginx
32
  RUN apt-get update && apt-get install -y nginx && rm -rf /var/lib/apt/lists/*
33
 
34
+ # Copy global nginx config to override default one
35
+ COPY frontend/nginx.global.conf /etc/nginx/nginx.conf
36
+
37
+ # Copy nginx server block
38
  COPY frontend/nginx.conf /etc/nginx/conf.d/default.conf
39
 
40
  # Link built frontend to nginx root
41
  RUN rm -rf /usr/share/nginx/html && \
42
  ln -s /app/frontend_build /usr/share/nginx/html
43
 
44
+ # Create required writable directories
45
+ RUN mkdir -p /app/tmp/body /app/tmp/proxy /app/tmp/fastcgi /app/tmp/uwsgi /app/tmp/scgi /app/logs && \
46
+ chmod -R 777 /app/tmp /app/logs
47
 
48
  # Create log directory for NGINX
49
  RUN mkdir -p /app/logs && chmod -R 777 /app/logs
frontend/nginx.global.conf ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # frontend/nginx.global.conf
2
+
3
+ # Remove user directive to avoid warning
4
+ # user nginx;
5
+
6
+ worker_processes 1;
7
+
8
+ events {
9
+ worker_connections 1024;
10
+ }
11
+
12
+ http {
13
+ include mime.types;
14
+ default_type application/octet-stream;
15
+
16
+ # Writable logs
17
+ access_log /app/logs/access.log;
18
+ error_log /app/logs/error.log warn;
19
+
20
+ sendfile on;
21
+ keepalive_timeout 65;
22
+
23
+ include /etc/nginx/conf.d/*.conf;
24
+ }