My budget VPS had ports 80/443 blocked by NAT — here's the architecture that got my site online
Описание и применение
Проблема: публичный VPS не принимал входящие соединения на порты 80/443 из‑за NAT. Решение: использовать outbound‑туннель Cloudflare (cloudflared), DNS‑01 ACME в Caddy и Tailscale для приватного доступа. После настройки сайт стал доступен, а SSH/DB остались защищёнными.
Задача
Public HTTP/HTTPS traffic could not reach the VPS because the provider’s 1:N NAT blocked inbound connections on ports 80/443.
Результат
The site became reachable over HTTPS without paying for a public IP or opening inbound ports, while SSH and database access remained isolated to the Tailscale mesh.
Рабочий процесс
- 1. Verify DNS and local firewall settings.
- 2. Inspect network interfaces; discover eth0 has private 10.x.x.x address due to provider NAT.
- 3. Confirm Caddy works locally with curl --resolve.
- 4. Deploy cloudflared daemon to establish outbound tunnel to Cloudflare.
- 5. Configure Cloudflare Tunnel ingress with originServerName to match Caddy’s SNI.
- 6. Set up Caddy with DNS‑01 ACME (Cloudflare API) and reverse_proxy to localhost:3000.
- 7. Enable Tailscale; bind SSH to tailscale0 interface only.
- 8. Disable public inbound ports on eth0.
- 9. Adjust Cloudflare settings: turn off Bot Fight Mode, set cache‑control for static assets.
- 10. Create verification script to check services and local TLS.
- 11. Test and iterate until stable.
Доказательства
The interface (eth0) didn't carry the public IP shown on my invoice. Instead, it held an address in the carrier-grade/shared range: 10.x.x.x (or 100.64.x.x).
The TLS handshake succeeded immediately. Caddy served the certificate, completed the negotiation, and returned the payload without complaint.
Once the tunnel came up, requests through the browser threw immediate 502 Bad Gateway errors.
- Дата записи: 2026-11-02T09:59:07.150Z