Cloudflare 521: Web Server Is Down

Symptom

All requests 521; origin unreachable from Cloudflare.

Root cause

Origin refused the TCP connection outright (service dead or port closed).

Fix, in order

1. Check the web service is runningsystemctl status nginx # or your server
2. Check the port is actually boundss -tlnp | grep :443
3. Check cloud firewall + hosting provider firewallufw status; iptables -L -n | head

Prevent it coming back

Pair uptime monitoring with auto-restart (systemd Restart=always).

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

Managed cloud hosting

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog