Dynamic routes with nginx

Source: https://serverfault.com/questions/249952/wildcard-vhosts-on-nginx

This Nginx configuration file below allows for wildcard hostnames that dynamically route to the corresponding folder in /var/www/vhost/ while also dynamically generating the respective log files.

http://test1.wildcard.com → /var/www/vhost/test1
                                                   /var/log/nginx/test1.wildcard.com-access.log                                                   /var/log/nginx/test1.wildcard.com-error.log

http://test2.wildcard.com → /var/www/vhost/test2
                                                   /var/log/nginx/test2.wildcard.com-access.log                                                   /var/log/nginx/test2.wildcard.com-error.log


server {
  listen 80;
  listen [::]:80;

  #  Match everything except dot and store in $subdomain variable
  #  Matches test1.wildcard.com, test1-demo.wildcard.com
  #  Ignores sub2.test1.wildcard.com
  server_name ~^(?<subdomain>[^.]+).wildcard.com;

  root /var/www/vhost/$subdomain;

  access_log /var/log/nginx/$host-access.log;
  error_log  /var/log/nginx/$host-error.log;

Additional links: https://bjornjohansen.no/nginx-redirect

Filter mailing lists with Dovecot Sieve

require ["fileinto", "variables"];

if header :matches "List-Post" "*<mailto:**@*.*.*>" {
  fileinto "INBOX.lists.${5}.${3}"; stop;

if header :matches "List-Post" "*<mailto:**@*.*>" {
  fileinto "INBOX.lists.${4}.${3}"; stop;

if header :matches "X-Mailing-List" "*@*.*.*" {
  fileinto "INBOX.lists.${3}.${1}"; stop;

if header :matches "X-Mailing-List" "*@*.*" {
  fileinto "INBOX.lists.${2}.${1}"; stop;

Teamspeak Dockerfile > Healthcheck

FROM teamspeak

RUN apk --update --no-cache add netcat-openbsd

HEALTHCHECK --interval=15s --timeout=1s --start-period=5s --retries=3 CMD echo quit | nc 10011 || false
# docker ps --filter ancestor=teamspeak

CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                 PORTS                                                                        NAMES
748e7f873a07        teamspeak_teamspeak   "entrypoint.sh ts3se…"   5 hours ago         Up 5 hours (healthy)>10011/tcp,>9987/udp,>30033/tcp   dvaec_teamspeak

fail2ban – Proxmox Webinterface

enabled = true
port = 8006
filter = proxmox
logpath = /var/log/daemon.log
maxretry = 3
bantime = 86400
failregex = pvedaemon\[.*authentication failure; rhost=<HOST> user=.*msg=.*
ignoreregex =