This commit is contained in:
Irwan Cahyono 2025-08-08 12:39:30 +07:00
parent 5046645795
commit a2b4212af5
3 changed files with 10 additions and 9 deletions

View File

@ -13,12 +13,16 @@ RUN npm run build
# Dockerfile untuk server Nuxt 3 # Dockerfile untuk server Nuxt 3
FROM nginx:1.29-alpine FROM nginx:1.29-alpine
RUN rm -f /etc/nginx/conf.d/default.conf RUN rm -rf /usr/share/nginx/html/* && \
rm -f /etc/nginx/conf.d/default.conf
# COPY nginx.conf /etc/nginx/conf.d/default.conf # COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d/ COPY nginx.conf /etc/nginx/conf.d/
COPY --from=builder /app/.output/public /usr/share/nginx/html COPY --from=builder /app/.output/public /usr/share/nginx/html
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chmod -R 755 /usr/share/nginx/html
EXPOSE 80 EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@ -9,6 +9,8 @@ services:
environment: environment:
- NODE_ENV=production - NODE_ENV=production
restart: unless-stopped restart: unless-stopped
volumes:
- ./nginx.conf:/etc/nginx/conf.d/nginx.conf:ro
logging: logging:
driver: "json-file" driver: "json-file"
options: options:

View File

@ -1,12 +1,12 @@
server { server {
listen 80; listen 80;
server_name _; server_name localhost;
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html;
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache";
} }
location /_nuxt/ { location /_nuxt/ {
@ -14,11 +14,6 @@ server {
add_header Cache-Control "public"; add_header Cache-Control "public";
} }
location = /index.html {
expires -1;
add_header Cache-Control "no-store";
}
location ~ /\. { location ~ /\. {
deny all; deny all;
} }