ng
This commit is contained in:
parent
16662bd65b
commit
01a1bae275
@ -13,7 +13,7 @@ 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 -rf /usr/share/nginx/html/* && \
|
RUN rm -rf /var/www/html/* && \
|
||||||
rm -f /etc/nginx/conf.d/default.conf
|
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/
|
||||||
@ -23,6 +23,8 @@ COPY --from=builder /app/.output/public /var/www/html
|
|||||||
RUN chown -R nginx:nginx /var/www/html && \
|
RUN chown -R nginx:nginx /var/www/html && \
|
||||||
chmod -R 755 /var/www/html
|
chmod -R 755 /var/www/html
|
||||||
|
|
||||||
|
RUN ln -s /var/www/html /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
|
|||||||
17
nginx.conf
17
nginx.conf
@ -2,19 +2,20 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
root /var/www/html;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = / {
|
location /_nuxt/ {
|
||||||
try_files /index.html =404;
|
expires 1y;
|
||||||
}
|
|
||||||
|
|
||||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
||||||
expires max;
|
|
||||||
add_header Cache-Control "public";
|
add_header Cache-Control "public";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location = /index.html {
|
||||||
|
expires -1;
|
||||||
|
add_header Cache-Control "no-store";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user