diff --git a/Dockerfile b/Dockerfile index 211bed4815b49a73c4b9ffba6c069fc81e24007d..b96babd2594369b9e39032702386099aa054238f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ RUN npm run build # 👉 Production stage FROM nginx:stable-alpine +COPY default.conf /etc/nginx/conf.d/default.conf +# ❗ถ้าอยากใช้ custom nginx.conf (optional) +# COPY nginx.conf /etc/nginx/nginx.conf # คัดลอกไฟล์ที่ build แล้ว ไปยัง nginx COPY --from=builder /app/dist /usr/share/nginx/html diff --git a/default.conf b/default.conf new file mode 100644 index 0000000000000000000000000000000000000000..d1da56ed2483112af249219dcfe8209ae6814817 --- /dev/null +++ b/default.conf @@ -0,0 +1,11 @@ +server { + listen 80; + server_name localhost; + + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } +} \ No newline at end of file diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..9b2a58fb227e33bb91e7abd0e40ebc403067b196 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,19 @@ +user nginx; +worker_processes auto; + +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + include /etc/nginx/conf.d/*.conf; # 🔥 load default.conf จาก conf.d +} \ No newline at end of file