I don't have a domain name, if I can enjoy caddy's local signed certification?

I don’t have a domain name, but I want to get the secure ability provided by TLS.
How to config in Caddy v2?

My Caddyfile is as follows:

:57777 {
tls internal
root * /var/www
file_server
}

I got the following output including errors:

caddy start -config “/etc/caddy/Caddyfile”
2020/06/01 16:34:56.679 INFO using provided configuration {“config_file”: “/etc/caddy/Caddyfile”, “config_adapter”: “”}
2020/06/01 16:34:56.682 INFO admin admin endpoint started {“address”: “tcp/localhost:2019”, “enforce_origin”: false, “origins”: ["[::1]:2019", “127.0.0.1:2019”, “localhost:2019”]}
2020/06/02 00:34:56 [INFO][cache:0xba7e740] Started certificate maintenance routine
2020/06/01 16:34:56.863 WARN pki.ca.local installing root certificate (you might be prompted for password) {“path”: “storage:pki/authorities/local/root.crt”}
2020/06/02 00:34:56 not NSS security databases found
2020/06/02 00:34:56 define JAVA_HOME environment variable to use the Java trust
2020/06/01 16:34:56.864 ERROR pki.ca.local failed to install root certificate {“error”: “install is not supported on this system”, “certificate_file”: “storage:pki/authorities/local/root.crt”}
2020/06/01 16:34:56.865 INFO tls cleaned up storage units
2020/06/01 16:34:56.866 INFO autosaved config {“file”: “/root/.config/caddy/autosave.json”}
2020/06/01 16:34:56.866 INFO serving initial configuration
Successfully started Caddy (pid=31949) - Caddy is running in the background

Indeed after I creat $HOME/.local/share/caddy/, I can find the root cert and intermediate cert generated there. So why still the error shows?

Welcome, @bluephoen1x

I moved your post to the Help category; the wiki category is only for articles that offer help on a specific topic.

For Caddy to manage a certificate for the domain name for your site (even for its own self-signed certificates) you just need to tell it which domain name(s) to manage for. Right now your site address is :57777 which is missing the domain name. Instead just use localhost:57777 and you’ll get a self-signed cert. More details here: https://caddyserver.com/docs/automatic-https#overview

1 Like

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