Help with Caddy install

Hi guys, I have dietpi for running mainly pihole.

Now I want to install caddy. Because port 80 is already taken by pihole, I set the port to 2015 in my caddyfile as:

:2015 {
        # Set this path to your site's directory.
        root * /mnt/share/public

        # Enable the static file server.
        file_server browse        
}

This works over http, but I can’t get it to work over https. When I change the first line to localhost:2015, it seems like it can’t install the certificate due to a permissions error. Can someone explain how I can fix this? I don’t know much about linux, so simple instructions is appreciated.

Jan 21 16:21:57 DietPi sudo[7755]: pam_unix(sudo:auth): conversation failed
Jan 21 16:21:57 DietPi sudo[7755]: pam_unix(sudo:auth): auth could not identify password for [caddy]
Jan 21 16:21:57 DietPi sudo[7755]:    caddy : user NOT in sudoers ; PWD=/ ; USER=root ; COMMAND=/usr/bin/tee /usr/local/share/ca-certificates/Caddy_Local_Authority_-_2024_ECC_Root_174717854674293354725174916880187717367.crt
Jan 21 16:21:57 DietPi caddy[7634]: {"level":"error","ts":1705825317.3510416,"logger":"pki.ca.local","msg":"failed to install root certificate","error":"failed to execute sudo: exit status 1","certificate_file":"storage:pki/authorities/local/root.crt"}

did you already tried to add caddy user to sudoers??

Thanks for the reply. I’m totally hopeless with linux and wasn’t sure if that was the right thing to do. Anyway, I found the answer in Caddy’s Github issue tracker. If you are faced with the same error, run:

sudo HOME=~caddy caddy trust

1 Like

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