Unable to locate SSL certificates

1. Caddy version (caddy version):

v2.2.1

2. How I run Caddy:

Install the caddy via

apt install caddy

Edit the Caddyfile in /etc/caddy/Caddyfile
And then start caddy

systemctl start caddy

a. System environment:

Ubuntu 18.04 (LTS) x64

b. Command:

 systemctl start caddy

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

domain.com {
        root * /var/www/domain
        file_server
        handle_errors {
                rewrite * /404.html
                file_server
        }
}

3. The problem I’m having:

I am unable to locate the SSL certificates of my website.

4. Error messages and/or full log output:

Not available

5. What I already tried:

$HOME/.caddy' doesn't exist, $CADDYPATH` is not set,

Type caddy environ and I get

caddy.HomeDir=/root
caddy.AppDataDir=/root/.local/share/caddy
caddy.AppConfigDir=/root/.config/caddy
caddy.ConfigAutosavePath=/root/.config/caddy/autosave.json
caddy.Version=v2.2.1
runtime.GOOS=linux
runtime.GOARCH=amd64
runtime.Compiler=gc
runtime.NumCPU=1
runtime.GOMAXPROCS=1
runtime.Version=go1.15.2
os.Getwd=/usr/share



LESSCLOSE=/usr/bin/lesspipe %s %s
LANG=C.UTF-8

USER=root
PWD=/usr/share
HOME=/root

XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
SSH_TTY=/dev/pts/0
MAIL=/var/mail/root
TERM=xterm
SHELL=/bin/bash
SHLVL=1
LOGNAME=root
XDG_RUNTIME_DIR=/run/user/0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
LESSOPEN=| /usr/bin/lesspipe %s
_=/usr/bin/caddy
OLDPWD=/usr/share/caddy

But root/.config and root/.local don’t exist

6. Links to relevant resources:

Since you’re running Caddy as a service, which runs Caddy with the caddy user, its $HOME is /var/lib/caddy.

When you run caddy environ, that shows you the environment of your current user, if you were to run Caddy. In your case, that’s the root user. Not the same as the one used by the service.

So look in /var/lib/caddy/.local/share/caddy.

1 Like

@francislavoie Thanks

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