Skip to content

2025

Setting up Loki/Grafana in Docker to analyze Nginx logs

To be honest, it's a little confusing how to get started because there are lots of instructions out there and docker compose files floating around that are outdated. Let's follow the office docs at https://grafana.com/docs/loki/latest/setup/install/docker/#install-with-docker-compose.

The docker compose file from the docs as of today is here: https://raw.githubusercontent.com/grafana/loki/v3.4.1/production/docker-compose.yaml. Note that the link is likely subject to change with new versions.

How to create trusted Emails

You set up a business email. Awesome! However, your outgoing emails on ending up in your recipients spam box. We need to fix that.

In this article, I'm going to use Microsoft 365 as my email provider, but the process will be similar for any provider.

Nginx in Docker with GeoIP

To use the GeoIP2 module. We pretty much need to use a Dockerfile to start with the latest nginx, but then compile the GeoIP2 module from source. This is preferred because using precompiled binaries is actually challenging - we have to ensure we get the binary that was compiled with the same nginx version that we have. Compiling the module ourselves actually simplifies this process.

Nginx in Docker with Local Let's Encrypt Certs

Docker Project folder

├── docker
│   ├── nginx
│   │   ├── docker-compose.yml
│   │   ├── cloudflare.ini
│   │   ├── nginx.conf
│   └── └── (any additional confs for server blocks)
└────────────

Setting up Tailscale Funnel

On the server with Tailscale, run tailscale funnel . You may get a message saying that Funnel is not enabled on your tailnet with a URL link. Click on the link to Enable funnel.

Ok, so Tailscale Funnel definitely does not support CNAME records. I could not get it to work unfortunately.