Add custom nginx config

This commit is contained in:
Ivan R. 2023-10-15 11:14:07 +05:00
parent 2d49ae5135
commit de64e3c005
No known key found for this signature in database
GPG key ID: 56C7BAAE859B302C
6 changed files with 31 additions and 3 deletions

View file

@ -6,3 +6,6 @@ trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 2
[nginx.conf]
indent_size = 4

View file

@ -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

12
nginx.conf Normal file
View file

@ -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;
}
}

View file

@ -1,6 +1,6 @@
<nav>
<a href="/">Главная</a>
<a href="/services">Сервисы</a>
<a href="/services/">Сервисы</a>
</nav>
<style>

8
src/pages/404.astro Normal file
View file

@ -0,0 +1,8 @@
---
import Layout from '../layouts/Layout.astro'
---
<Layout title="Страница не найдена" description="Ошибка 404: такой страницы не существует">
<h1>404</h1>
<p>Такой страницы не существует :(</p>
</Layout>

View file

@ -14,7 +14,11 @@ import Note from '../components/Note.astro'
</p>
<h2>Заметки</h2>
<Note date="27 августа 2023" title="Свободные альтернативы популярным сервисам" href="/notes/self-hosting" />
<Note
date="27 августа 2023"
title="Свободные альтернативы популярным сервисам"
href="/notes/self-hosting/"
/>
</Layout>
<style>