Serve multisite blogs from explicit Nginx roots
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
This commit is contained in:
parent
b3cd8a8914
commit
64a9ce84d4
3 changed files with 64 additions and 32 deletions
|
|
@ -11,6 +11,7 @@ RUN npm run build
|
||||||
FROM nginx:1.27-alpine AS runtime
|
FROM nginx:1.27-alpine AS runtime
|
||||||
|
|
||||||
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
COPY deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
COPY deploy/blog-locations.conf /etc/nginx/snippets/blog-locations.conf
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
|
||||||
19
deploy/blog-locations.conf
Normal file
19
deploy/blog-locations.conf
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log;
|
||||||
|
error_log /var/log/nginx/error.log warn;
|
||||||
|
|
||||||
|
location = /nginx-health {
|
||||||
|
access_log off;
|
||||||
|
return 204;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~* \.(?:css|js|mjs|png|jpg|jpeg|gif|svg|webp|ico|woff2?)$ {
|
||||||
|
try_files $uri =404;
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/index.html /index.html /404.html;
|
||||||
|
}
|
||||||
|
|
@ -1,36 +1,48 @@
|
||||||
map $host $blog_site {
|
server {
|
||||||
default research;
|
listen 80 default_server;
|
||||||
research.neeldhara.blog research;
|
server_name research.neeldhara.blog research.neeldhara.email _;
|
||||||
vibes.neeldhara.blog vibes;
|
root /usr/share/nginx/html/research;
|
||||||
puzzles.neeldhara.blog puzzles;
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
reflections.neeldhara.blog reflections;
|
|
||||||
poetry.neeldhara.blog poetry;
|
|
||||||
reviews.neeldhara.blog reviews;
|
|
||||||
art.neeldhara.blog art;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80;
|
||||||
server_name _;
|
server_name vibes.neeldhara.blog vibes.neeldhara.email;
|
||||||
|
root /usr/share/nginx/html/vibes;
|
||||||
root /usr/share/nginx/html/$blog_site;
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
index index.html;
|
}
|
||||||
|
|
||||||
access_log /var/log/nginx/access.log;
|
server {
|
||||||
error_log /var/log/nginx/error.log warn;
|
listen 80;
|
||||||
|
server_name puzzles.neeldhara.blog puzzles.neeldhara.email;
|
||||||
location = /nginx-health {
|
root /usr/share/nginx/html/puzzles;
|
||||||
access_log off;
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
return 204;
|
}
|
||||||
}
|
|
||||||
|
server {
|
||||||
location ~* \.(?:css|js|mjs|png|jpg|jpeg|gif|svg|webp|ico|woff2?)$ {
|
listen 80;
|
||||||
try_files $uri =404;
|
server_name reflections.neeldhara.blog reflections.neeldhara.email;
|
||||||
expires 1y;
|
root /usr/share/nginx/html/reflections;
|
||||||
add_header Cache-Control "public, immutable";
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
server {
|
||||||
try_files $uri $uri/ /404.html;
|
listen 80;
|
||||||
}
|
server_name poetry.neeldhara.blog poetry.neeldhara.email;
|
||||||
|
root /usr/share/nginx/html/poetry;
|
||||||
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name reviews.neeldhara.blog reviews.neeldhara.email;
|
||||||
|
root /usr/share/nginx/html/reviews;
|
||||||
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name art.neeldhara.blog art.neeldhara.email;
|
||||||
|
root /usr/share/nginx/html/art;
|
||||||
|
include /etc/nginx/snippets/blog-locations.conf;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue