From de64e3c005e105a44b1555b26be60444159fbc82 Mon Sep 17 00:00:00 2001 From: Ivan Reshetnikov Date: Sun, 15 Oct 2023 11:14:07 +0500 Subject: [PATCH] Add custom nginx config --- .editorconfig | 3 +++ Dockerfile | 3 ++- nginx.conf | 12 ++++++++++++ src/components/Navbar.astro | 2 +- src/pages/404.astro | 8 ++++++++ src/pages/index.astro | 6 +++++- 6 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 nginx.conf create mode 100644 src/pages/404.astro diff --git a/.editorconfig b/.editorconfig index 3af1aa2..be25b4c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,3 +6,6 @@ trim_trailing_whitespace = true charset = utf-8 indent_style = space indent_size = 2 + +[nginx.conf] +indent_size = 4 diff --git a/Dockerfile b/Dockerfile index 8e36a13..97f94c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,4 +10,5 @@ RUN npm run build FROM nginx:alpine -COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /app/dist /usr/share/comfycamp +COPY nginx.conf /etc/nginx/conf.d/default.conf diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..51fbf62 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,12 @@ +server { + root /usr/share/comfycamp; + error_page 404 /404.html; + + location ~ \.(png|ico|svg|ttf|webp)$ { + add_header Cache-Control "public, max-age=86400"; + } + + location / { + index index.html index.htm; + } +} diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index d2efab1..2b8584d 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,6 +1,6 @@