Getting started

I have just installed Caddy V2 on Ubuntu. Thought I’d start at the beginning with the tutorial. I’m on the
Getting Started page. I type in curl localhost:2019/config/ and don’t expect to see anything. However, the following is displayed:


Is this expected?

How did you install Caddy, exactly?

That getting started page assumes that you haven’t installed it using a distro that also supplies a starting Caddyfile, or automatically sets it up as a service, etc. (which an Ubuntu package may have done, but I’m not sure).

Anyway, basically the clue here is that there’s a Caddyfile at /etc/caddy/Caddyfile that it’s probably using, and it’s got a file server set up to serve files out of /usr/share/caddy on requests to port 80.

Yup! The .deb/apt repo enables the service by default.

1 Like

@Whitestrake Thanks for replying.

As per the Ubuntu instruction on the Install page and then I basically started stepping through the tutorial.

Hmm. We might want to update that Getting Started doc to take that into account. It’s not like people installing that way is going to be uncommon, heh.

1 Like

Do I need to turn off something so I can continue with the tutorial?

Think you could probably just stop the service for the duration of the tutorial and start it again after.

@francislavoie will probably comment momentarily with the service name, I expect, if he’s thinking along the same lines…

1 Like

I agree. /cc @matt

Yep you can run sudo service caddy stop or sudo systemctl disable caddy if you want to turn off the service entirely. If you just stop it, I’m pretty sure it’ll get started again on your next reboot.


Thanks gentlemen, still some weird things happening so I’ve uninstalled and reinstalled Caddy just to start fresh again. I’ll report back shortly if I come up against a hurdle again.

1 Like

The tutorial makes a whole lot more sense now :grinning:


OK. The tutorial starts to fall apart again for a Ubuntu/Caddy noob from the heading ‘Start, stop, run’ in Getting Started. Fortunately, you’ve both provided enough clues to allow me to figure out how to move ahead, but other noobs reading this thread might like to note the following:

If using Ubuntu:

caddy start => sudo service caddy start
caddy stop => sudo service caddy stop
caddy reload => sudo service caddy reload

In addition, Caddy expects the Caddyfile in /etc/caddy/. caddy reload --config $HOME/Caddyfile will allow you to use a Caddyfile in the home directory. To get back to the default behaviour caddy reload --config /etc/caddy/Caddyfile There is one there already. Renaming it to something like Caddyfile.sample allowed me to continue with the tutorial. Note elevated privileges are required e.g. sudo mv Caddyfile Caddyfile.sample and sudo nano Caddyfile

Is there a way to use the --config directive to use a Caddyfile in say $HOME so that the previous paragraph can be avoided? I tried caddy adapt --config $HOME/Caddyfile and then sudo service caddy reload, but it still wants to use /etc/caddy/Caddyfile.

I keep coming up against roadblocks with the tutorial. Next is Caddyfile Quick-start. At the line curl https://localhost, I get the response:

I’ve had a look at the reference, but it’s all gobbledygook to me. Sorry.

When you run Caddy with HTTPS for localhost, it asks for a password (if not already root) to install its root certificate into your trust store. Either that failed or it’s still waiting for your password :stuck_out_tongue:

OK. so I get the correct behaviour using sudo caddy start. I get the wrong behaviour using sudo service caddy start. There’s clearly a difference, but I’m not sure what it is? To begin the tutorial, I had to run sudo service caddy stop first. So I’m guessing this is also different to sudo caddy stop?

service and systemctl are commands that manage services that run on your machine, i.e. programs that are set up to be automatically restarted if they crash, or automatically started when your machine boots. The apt package sets up the service automatically on installation.

Using caddy start is essentially just running Caddy directly, bypassing the system service.

caddy stop will send a command to whatever instance of Caddy that is running and listening at the configured admin endpoint, or barring that, the admin endpoint listening at localhost:2019. This means that it can stop either a Caddy instance managed by a service, or the one you ran manually.

1 Like

Great! Thanks for that. The fog is beginning to clear.

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