This commit is contained in:
Irwan Cahyono 2025-08-08 13:11:59 +07:00
parent 16662bd65b
commit 01a1bae275
2 changed files with 13 additions and 10 deletions

View File

@ -13,7 +13,7 @@ RUN npm run build
# Dockerfile untuk server Nuxt 3
FROM nginx:1.29-alpine
RUN rm -rf /usr/share/nginx/html/* && \
RUN rm -rf /var/www/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/
@ -23,6 +23,8 @@ COPY --from=builder /app/.output/public /var/www/html
RUN chown -R nginx:nginx /var/www/html && \
chmod -R 755 /var/www/html
RUN ln -s /var/www/html /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -2,19 +2,20 @@ server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
root /var/www/html;
index index.html;
location / {
try_files $uri $uri/ =404;
try_files $uri $uri/ /index.html;
}
location = / {
try_files /index.html =404;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
expires max;
location /_nuxt/ {
expires 1y;
add_header Cache-Control "public";
}
location = /index.html {
expires -1;
add_header Cache-Control "no-store";
}
}