A production stack that combines Cloudflare's edge with SafeLine's detection:
User → Cloudflare (DNS/CDN) → Nginx Proxy Manager (SSL) → SafeLine WAF → Your App
Why This Stack
- Cloudflare: Free DNS, CDN, basic DDoS protection
- Nginx Proxy Manager: Easy SSL via Let's Encrypt GUI
- SafeLine: 71.65% attack detection, semantic engine, bot protection
- Your App: Protected three layers deep, $0/month in WAF licensing
Prerequisites
A VPS with Docker and at least 2 GB RAM. All services run in containers.
Step 1: Deploy Your App
Ensure your app is containerized and listening on an internal port (e.g., localhost:3000).
Step 2: Install SafeLine
bash -c "$(curl -fsSLk https://waf.chaitin.com/release/latest/manager.sh)" -- --en
SafeLine tries to bind ports 80/443. Since NPM will handle those, set SafeLine to an internal port like 5080 in the dashboard settings.
Step 3: Configure SafeLine
- Open
https://your-ip:9443and log in - Add a new site, point to
app-container:3000 - Verify:
curl -H "Host: yourdomain.com" http://localhost:5080
Step 4: Install Nginx Proxy Manager
docker run -d \
--name nginx-proxy-manager \
-p 80:80 \
-p 443:443 \
-p 81:81 \
-v npm_data:/data \
-v npm_letsencrypt:/etc/letsencrypt \
jc21/nginx-proxy-manager:latest
Step 5: Configure NPM
- Open
http://your-ip:81(default: admin@example.com / changeme) - Add SSL via Let's Encrypt
- Create Proxy Host -> forward to
http://safeline-container:5080 - Enable SSL, force HTTPS
Step 6: Configure Cloudflare
- Set DNS A record to your VPS IP
- SSL/TLS -> "Full (strict)"
Step 7: Test
# Should be blocked
curl -H "Host: yourdomain.com" "http://your-ip/?id=1' OR '1'='1"
# Should pass
curl -H "Host: yourdomain.com" "http://your-ip/"
Read the full comparison: SafeLine vs Cloudflare WAF: An Honest, Detailed Comparison — why self-hosted beats cloud-only for detection rate.
FAQ
Does this add latency?
NPM + SafeLine add ~1-2ms. Cloudflare's CDN compensates.
Why three layers instead of just Cloudflare?
Cloudflare Free WAF catches ~11%. SafeLine catches ~71%.
Can I skip NPM?
Yes. SafeLine can terminate SSL directly.
Try SafeLine yourself: Live Demo | Website | Deploy Guide | Discord Community | More from CyberServal | LinkedIn
Top comments (0)