diff --git a/Dockerfile b/Dockerfile index ae39bea..30cb98d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN npm install --legacy-peer-deps COPY . . -RUN npm run build +RUN npm run generate # Dockerfile untuk server Nuxt 3 FROM nginx:1.29-alpine diff --git a/nginx.conf b/nginx.conf index 15034d7..9e96c1a 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,20 +2,25 @@ server { listen 80; server_name localhost; - root /var/www/html; - index index.html; - location / { + root /var/www/html; + index index.html; try_files $uri $uri/ /index.html; } location /_nuxt/ { + alias /var/www/html/_nuxt/; expires 1y; add_header Cache-Control "public"; } - location = /index.html { - expires -1; - add_header Cache-Control "no-store"; + location ~ /\. { + deny all; + } + + error_page 404 /index.html; + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; } } diff --git a/nuxt.config.ts b/nuxt.config.ts index 6b35f50..0f4da0d 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -76,14 +76,10 @@ export default defineNuxtConfig({ }, }, - ssr: false, -// nitro: { -// preset: 'static', // Generate file static -// prerender: { -// failOnError: false, // Skip error saat generate -// ignore: ['/dynamic-route'], // Ignore route tertentu -// crawlLinks: false // Nonaktifkan crawler -// } -// }, + ssr: false, + target: 'static', + generate: { + dir: '.output/public', + } }); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 7717e2b..96cf5ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3515,7 +3515,6 @@ }, "node_modules/@parcel/watcher-wasm/node_modules/napi-wasm": { "version": "1.1.0", - "dev": true, "inBundle": true, "license": "MIT" },