Cloudflare Error 522 new caddy install debian 11

1. Caddy version (caddy version):

2.4.6

2. How I run Caddy:

Caddy runs in an LXC with service start caddy

a. System environment:

Debian 11 proxmox LXC

b. Command:

service caddy start
service caddy status

c. Service/unit/compose file:

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddyfile or JSON config:

Paste config here, replacing this text.
tws.rocks {
        # Set this path to your site's directory.
        root * /var/www/html/tws.rocks

        # Enable the static file server.
        file_server

        # reverse_proxy localhost:8080

        # php_fastcgi localhost:9000
}

3. The problem I’m having:

I’m getting cloudflare error 522, it was error 521 saying webserver is not reachable but everything is open, ports, no firewall etc. Then switched to error 522

4. Error messages and/or full log output:

There’s not really any errors except the 522 error

5. What I already tried:

Honestly I’ve tried everything I can think of. Reinstalling caddy, checking ports are open in the container and on my router which they are. It was working on nginx and I wanted to switch to caddy. It’s a separate brand new container than the nginx one. I’ve tried removing the domain from CF and adding back, tried making the cloud grey so it isn’t proxied by CF, tried a different domain, tried doing everything from scratch from a brand new container

I’ve tried so much stuff over the past 2 days it’s hard to keep track. So I’m posting here if anyone has any clue on what else I can try

6. Links to relevant resources:

This topic was automatically closed after 30 days. New replies are no longer allowed.