nycki.net/content/howto.md

1.4 KiB

layout title
layouts/base.njk How to self-host a blog with 11ty, git, and Decap CMS

{{ title }}

Server: debian

Apache

Install apache2

apt install apache2

Config file

# https://palmure.fr/blog.html#default-https-but-only-for-recent-browsers
<VirtualHost *:80 *:443>
  ServerName example.net
  SSLEngine on
  Include /etc/letsencrypt/options-ssl-apache.conf
  
  Header always add Strict-Transport-Security: "max-age=31536000"; includeSubDomains; preload;"
  <If "%{HTTPS} == 'off'">
    <If "%{HTTP:Upgrade-Insecure-Requests} == 1">
      Header always add Vary: Upgrade-Insecure-Requests
      Redirect / https://example.net
    </If>
  </If>
  
  DocumentRoot /data/example.net/site
  ErrorDocument 404 404.html
  
  <Directory />
    Options FollowSymLinks MultiViews
    Require all granted
  </Directory>
  SSLCertificateFile    /etc/letsencrypt/live/example.net/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.net/privkey.pem
</VirtualHost>
  
<VirtualHost *:443>
  ServerName git.example.net
  SSLEngine on
  Include /etc/letsencrypt/options-ssl-apache.conf
  
  # https://stackoverflow.com/a/9933890/3821202
  AllowEncodedSlashes NoDecode
  <Location />
    ProxyPass http://localhost:8100/ nocanon
  </Location>
  SSLCertificateFile    /etc/letsencrypt/live/example.net/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.net/privkey.pem
</VirtualHost>

Last updated 2024-12-23.