Method: Docker Compose + Cloudflare Tunnel (No Port Forwarding Required)
yourdomain.com).Skip this if your domain is already managed by Cloudflare.
yourdomain.com) and select the Free Plan.bob.ns.cloudflare.com).This creates a secure link from your server to the internet without opening router ports.
cloudflaredRun this on your Linux server:
# Download and install the package
curl -L --output cloudflared.deb [https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb](https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb)
sudo dpkg -i cloudflared.deb
# Login (this gives you a URL to visit in your browser)
cloudflared tunnel login
# Create a new tunnel (Save the UUID output!)
cloudflared tunnel create langfuse-production
# Link your specific subdomain to the tunnel
# Replace <UUID> with your real ID from the previous command
cloudflared tunnel route dns <UUID> langfuse.yourdomain.com
The background service runs as root, so it needs the keys in /etc/cloudflared.
sudo mkdir -p /etc/cloudflared
sudo cp ~/.cloudflared/cert.pem /etc/cloudflared/
sudo cp ~/.cloudflared/*.json /etc/cloudflared/
Create the config file: sudo nano /etc/cloudflared/config.yml
Paste the following content (Update <UUID> and hostname):
tunnel: <UUID>
credentials-file: /etc/cloudflared/<UUID>.json
ingress:
- hostname: langfuse.yourdomain.com
service: [http://127.0.0.1:3000](http://127.0.0.1:3000)
- service: http_status:404
# Install the system service
sudo cloudflared service install
# Start and enable it
sudo systemctl start cloudflared
sudo systemctl enable cloudflared
Verification: Run sudo systemctl status cloudflared. It should be active (running).
You must update Langfuse to know its public URL, otherwise login will fail.
docker-compose.ymlOpen your file (nano docker-compose.yml) and update the langfuse-web service environment variables.
Crucial Changes:
1. NEXTAUTH_URL: Must match your https domain.
2. NEXT_PUBLIC_LANGFUSE_BASEURL: Must match your https domain.
3. Ports: Ensure it binds to 127.0.0.1 or 0.0.0.0.
Example Snippet:
langfuse-web:
image: docker.io/langfuse/langfuse:3
restart: always
depends_on: *langfuse-depends-on
ports:
- 3000:3000
environment:
<<: *langfuse-worker-env
# --- NETWORK CONFIGURATION ---
NEXTAUTH_URL: [https://langfuse.yourdomain.com](https://langfuse.yourdomain.com)
NEXT_PUBLIC_LANGFUSE_BASEURL: [https://langfuse.yourdomain.com](https://langfuse.yourdomain.com)
# -----------------------------
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-mysecret}
# ... (keep other existing variables) ...
docker compose down
docker compose up -d
langfuse CNAME record is Proxied (Orange Cloud icon).Visit https://langfuse.yourdomain.com.
1.1.1.1 or run sudo killall -HUP mDNSResponder (Mac) / ipconfig /flushdns (Windows).