Where do I save caddyfile on Debian server?

1. The problem I’m having:

I am attempting so serve a static website from a Debian 12 server using Caddy.

Problem 1:
I entered this command <caddy file-server --domain example.com> and received the following error.

Error: loading new config: http app module: start: listening on :80: listen tcp :80: bind: address already in use

I am attempting to correct the error with a Caddyfile but I am unsure of where to save the Caddyfile.

2. Error messages and/or full log output:

Error: loading new config: http app module: start: listening on :80: listen tcp :80: bind: address already in use

3. Caddy version: v2.6.4

4. How I installed and ran Caddy:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy

a. System environment:

Debian 12
Website files are saved in /SRV/example

b. Command:

caddy file-server --domain example.com

c. Service/unit/compose file:

d. My complete Caddy config:

I would like to create a Caddyfile but I am unsure where I should save it.

5. Links to relevant resources:

1 Like

Since you installed Caddy with the apt repo, it’s already running as a systemd service and waiting for you to configure it. See the docs here for instructions:

1 Like

@francislavoie Thanks for the help. The server is working now.

The help you provided another user (linked below) also helped me to understand what was happening.

1 Like

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