Caddy is not working on fresh distro installation

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

I am intending on using my Linux-based PC as a persistent online server for FoundryVTT. I am currently getting my system configured

a. System environment:

Ubuntu 22.04 1 LTS

b. Command:

sudo service caddy start
sudo service caddy restart
sudo service caddy stop

c. Service/unit/compose file:

# Unsure of what to put here as this is
# my first experience in trying to run Linux

d. My complete Caddy config:

# This replaces the existing content in /etc/caddy/Caddyfile

# A CONFIG SECTION FOR YOUR IP AND HOSTNAME

{
    default_sni 192.168.1.242
}

192.168.1.242 {
    # PROXY ALL REQUEST TO PORT 30000
    tls internal
    reverse_proxy localhost:30000
    encode zstd gzip
}

or10nfoundry.thenest.org {
    # PROXY ALL REQUEST TO PORT 30000
    reverse_proxy localhost:30000
    encode zstd gzip
}

# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

3. The problem I’m having:

Simply put, I am setting up my Linux system to be a persistent

4. Error messages and/or full log output:

e[0;1;31m×e[0m caddy.service - Caddy
     Loaded: loaded (/lib/systemd/system/caddy.service; enabled; vendor preset: enabled)
     Active: e[0;1;31mfailede[0m (Result: exit-code) since Sun 2022-11-20 16:49:58 EST; 7min ago
       Docs: https://caddyserver.com/docs/
    Process: 7698 ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile e[0;1;31m(code=exited, status=1/FAILURE)e[0m
   Main PID: 7698 (code=exited, status=1/FAILURE)
     Status: "loading new config: http app module: start: listening on :80: listen tcp :80: bind: address already in use"
        CPU: 51ms

Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.7754562,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.7755146,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.7755513,"logger":"tls","msg":"finished cleaning storage units"}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.7755766,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 2048 kiB, got: 416 kiB). See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details."}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.7756886,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: {"level":"info","ts":1668980998.775784,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0000a2e00"}
Nov 20 16:49:58 or10n-linuxserver caddy[7698]: Error: loading initial config: loading new config: http app module: start: listening on :80: listen tcp :80: bind: address already in use
Nov 20 16:49:58 or10n-linuxserver systemd[1]: e[0;1;39me[0;1;31me[0;1;39mcaddy.service: Main process exited, code=exited, status=1/FAILUREe[0m
Nov 20 16:49:58 or10n-linuxserver systemd[1]: e[0;1;38;5;185me[0;1;39me[0;1;38;5;185mcaddy.service: Failed with result 'exit-code'.e[0m
Nov 20 16:49:58 or10n-linuxserver systemd[1]: e[0;1;31me[0;1;39me[0;1;31mFailed to start Caddy.e[0m

5. What I already tried:

I’m not really entirely sure what else I can try at this point. This is already the second time I reinstalled Ubuntu to start fresh because of an unrelated issue. Caddy was working fine for me the last time I attempted this and I did not deviate from a tutorial I’d been following.

6. Links to relevant resources:

(Recommended Linux installation for FoundryVTT) Recommended Linux Installation Guide | Foundry VTT Community Wiki

This is the key:

There’s another web server listening on port 80, so Caddy is not able to listen on the same port. Run this command and check for the PID/Program name where the Local Address has port 80:

sudo netstat -luntp
2 Likes

I’ve found the culprit. It seems that through a different process entirely I went and installed Apache2 and it configured itself to listen on Port 80. I’m working on trying to remove this.

2 Likes