fixed
Browse files- Dockerfile +8 -1
- nginx.conf +25 -7
Dockerfile
CHANGED
@@ -24,7 +24,14 @@ FROM nginx:alpine
|
|
24 |
COPY --from=build /app/dist /usr/share/nginx/html
|
25 |
|
26 |
# Copy a custom Nginx configuration file
|
27 |
-
COPY nginx.conf /etc/nginx/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Expose port 8080
|
30 |
EXPOSE 8080
|
|
|
24 |
COPY --from=build /app/dist /usr/share/nginx/html
|
25 |
|
26 |
# Copy a custom Nginx configuration file
|
27 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
28 |
+
|
29 |
+
# Create necessary directories and set permissions
|
30 |
+
RUN mkdir -p /var/cache/nginx /var/run /var/log/nginx && \
|
31 |
+
chmod -R 777 /var/cache/nginx /var/run /var/log/nginx /etc/nginx/nginx.conf
|
32 |
+
|
33 |
+
# Switch to non-root user
|
34 |
+
USER nginx
|
35 |
|
36 |
# Expose port 8080
|
37 |
EXPOSE 8080
|
nginx.conf
CHANGED
@@ -1,11 +1,29 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
server_name localhost;
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
|
|
|
10 |
}
|
11 |
}
|
|
|
1 |
+
worker_processes auto;
|
2 |
+
pid /tmp/nginx.pid;
|
|
|
3 |
|
4 |
+
events {
|
5 |
+
worker_connections 1024;
|
6 |
+
}
|
7 |
+
|
8 |
+
http {
|
9 |
+
include /etc/nginx/mime.types;
|
10 |
+
default_type application/octet-stream;
|
11 |
+
|
12 |
+
access_log /tmp/access.log;
|
13 |
+
error_log /tmp/error.log;
|
14 |
+
|
15 |
+
sendfile on;
|
16 |
+
keepalive_timeout 65;
|
17 |
+
|
18 |
+
server {
|
19 |
+
listen 8080;
|
20 |
+
server_name localhost;
|
21 |
+
|
22 |
+
root /usr/share/nginx/html;
|
23 |
+
index index.html;
|
24 |
|
25 |
+
location / {
|
26 |
+
try_files $uri $uri/ /index.html;
|
27 |
+
}
|
28 |
}
|
29 |
}
|