add aliases and fix permalinks
Some checks failed
continuous-integration/drone/pr Build is failing

This commit is contained in:
Robert Kaussow 2022-03-13 11:57:09 +01:00
parent 79f9d38f87
commit eb7a76b14a
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
11 changed files with 34 additions and 7 deletions

View File

@ -17,6 +17,9 @@ markup:
startLevel: 1
endLevel: 9
permalinks:
posts: /:year/:month/:title/
taxonomies:
author: authors
tag: tags

View File

@ -1,6 +1,8 @@
---
title: "Ansible and the relations to the inventory"
date: 2020-08-03T22:45:00+02:00
aliases:
- /ansible-and-the-relations-to-the-inventory/
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "Color palettes on Game Boy Color and Advance"
date: 2020-09-15T21:45:00+02:00
aliases:
- /color-palettes-on-gbc-and-gba/
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "Create a static site hosting platform"
date: 2020-07-30T01:05:00+02:00
aliases:
- /create-a-static-site-hosting-platform/
authors:
- robert-kaussow
tags:
@ -8,7 +10,7 @@ tags:
- Sysadmin
resources:
- name: feature
src: 'images/feature.jpg'
src: "images/feature.jpg"
params:
anchor: Center
credits: >
@ -17,7 +19,9 @@ resources:
---
There are a lot of static site generators out there and users have a lot of possibilities to automate and continuously deploy static sites these days. Solutions like GitHub pages or Netlify are free to use and easy to set up, even a cheap webspace could work. If one of these services is sufficient for your use case you could stop reading at this point.
<!--more-->
As I wanted to have more control over such a setup and because it might be fun I decided to create my own service. Before we look into the setup details, lets talk about some requirements:
- deploy multiple project documentation
@ -90,13 +94,13 @@ server {
We will go through this configuration to understand how it works.
__*Lines 1-3*__ defines a backend, in this case it's the Minio server running on `localhost:61000`.
**_Lines 1-3_** defines a backend, in this case it's the Minio server running on `localhost:61000`.
__*Lines 5-10*__ should also be straight forward, this block will redirect HTTP to HTTPS.
**_Lines 5-10_** should also be straight forward, this block will redirect HTTP to HTTPS.
__*Line 14*__ is where the magic starts. We are using a named regular expression to capture the first part of the subdomain and translate it into the bucket sub-directory. For a given URL like `demoproject.mydocs.com` Nginx will try to serve `mydocs/demoproject` from the Minio server. That's what __*Line 23*__ does. Some of you may notice that the used variable `${request_path}` is not defined in the vHost configuration.
**_Line 14_** is where the magic starts. We are using a named regular expression to capture the first part of the subdomain and translate it into the bucket sub-directory. For a given URL like `demoproject.mydocs.com` Nginx will try to serve `mydocs/demoproject` from the Minio server. That's what **_Line 23_** does. Some of you may notice that the used variable `${request_path}` is not defined in the vHost configuration.
Right, we need to add another configuration snippet to the `nginx.conf`. But why do we need this variable at all? For me, that was the hardest part to solve. As the setup is using `proxy_pass` Nginx will *not* try to lookup `index.html` automatically. That's a problem because every folder will at least contain an `index.html`. In general, it's required to tell Nginx to rewrite the request URI to `/index.html` if the origin is a folder and ends with `/`. One way would be an `if` condition in the vHost configuration but such conditions are evil[^if-is-evil] in most cases and should be avoided if possible. Luckily there is a better option:
Right, we need to add another configuration snippet to the `nginx.conf`. But why do we need this variable at all? For me, that was the hardest part to solve. As the setup is using `proxy_pass` Nginx will _not_ try to lookup `index.html` automatically. That's a problem because every folder will at least contain an `index.html`. In general, it's required to tell Nginx to rewrite the request URI to `/index.html` if the origin is a folder and ends with `/`. One way would be an `if` condition in the vHost configuration but such conditions are evil[^if-is-evil] in most cases and should be avoided if possible. Luckily there is a better option:
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
@ -113,7 +117,7 @@ map $request_uri $request_path {
[Nginx maps](https://nginx.org/en/docs/http/ngx_http_map_module.html) are a solid way to create conditionals. In this example set `$request_uri` as input and `$request_path` as output. Each line between the braces is a condition. The first line will simply apply `$request_uri` to the output variable if no other condition match. The second condition applies `${request_uri}index.html` to the output variable if the input variable ends with a slash (and therefor is a directory).
__*Line 38-41*__ of the vHost configuration tries to deliver the custom error page of your site and will fallback to the default Nginx error page.
**_Line 38-41_** of the vHost configuration tries to deliver the custom error page of your site and will fallback to the default Nginx error page.
We are done! Nginx should now be able to server your static sites from a sub-directory of the Minio source bucket. I'm using it since a few weeks and I'm really happy with the current setup.

View File

@ -1,6 +1,8 @@
---
title: "Docker port publishing for localhost bindings"
date: 2020-09-08T22:15:00+02:00
aliases:
- /docker-port-publishing-for-localhost-bindings/
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "How to modernize a Game Boy"
date: 2020-09-13T23:45:00+02:00
aliases:
- modernize-a-game-boy-advance
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "Run an ARM32 Docker daemon on ARM64 servers"
date: 2020-09-24T10:30:00+02:00
aliases:
- run-arm32-docker-daemon-on-arm64-servers
authors:
- robert-kaussow
tags:

View File

@ -1,13 +1,15 @@
---
title: "Welcome (back)"
date: 2020-07-21T23:00:08+02:00
aliases:
- welcome
authors:
- robert-kaussow
tags:
- General
resources:
- name: feature
src: 'images/feature.jpg'
src: "images/feature.jpg"
params:
anchor: Center
credits: >
@ -16,7 +18,9 @@ resources:
---
As some former readers may have noticed, "geeklabor.de" has been renamed to "thegeeklab.de", welcome back nice to have you here again. If you are a first time visitor, a very warm welcome goes to you as well. This is my private blog, where I write about everything that comes to my mind but mainly about topics from the Linux and Open Source world.
<!--more-->
For those of you who are interested in the backgrounds about the blog migration, here you go:
- my old theme had to be reworked, [hugo-geekblog](https://github.com/thegeeklab/hugo-geekblog) was born

View File

@ -1,6 +1,8 @@
---
title: "Toolbox 1: direnv"
date: 2021-05-17T21:24:00+01:00
aliases:
- toolbox-1-direnv
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "Toolbox 2: git-plus"
date: 2021-06-19T09:50:00+01:00
aliases:
- toolbox-2-git-plus
authors:
- robert-kaussow
tags:

View File

@ -1,6 +1,8 @@
---
title: "SSL certificate monitoring pitfalls"
date: 2022-01-31T23:00:00+01:00
aliases:
- /ssl-certificate-monitoring-pitfalls/
authors:
- robert-kaussow
tags: