1. The problem I’m having:
Hi Team,
I am very new to caddy and I have installed caddy in my Ubuntu machine.
I am planning to change my quic conf in caddy conf file but unable to do.
Could you please share example conf file and any info where can i change my listening port?
2. Error messages and/or full log output:
journalctl -u caddy --no-pager | less +G
Oct 07 08:18:35 ubuntu systemd[1]: caddy.service: Main process exited, code=exited, status=1/FAILURE
Oct 07 08:18:35 ubuntu systemd[1]: caddy.service: Failed with result 'exit-code'.
Oct 07 08:18:35 ubuntu systemd[1]: Failed to start Caddy.
Oct 07 08:26:47 ubuntu systemd[1]: Starting Caddy...
Oct 07 08:26:47 ubuntu caddy[270620]: caddy.HomeDir=/var/lib/caddy
Oct 07 08:26:47 ubuntu caddy[270620]: caddy.AppDataDir=/var/lib/caddy/.local/share/caddy
Oct 07 08:26:47 ubuntu caddy[270620]: caddy.AppConfigDir=/var/lib/caddy/.config/caddy
Oct 07 08:26:47 ubuntu caddy[270620]: caddy.ConfigAutosavePath=/var/lib/caddy/.config/caddy/autosave.json
Oct 07 08:26:47 ubuntu caddy[270620]: caddy.Version=v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.GOOS=linux
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.GOARCH=amd64
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.Compiler=gc
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.NumCPU=8
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.GOMAXPROCS=8
Oct 07 08:26:47 ubuntu caddy[270620]: runtime.Version=go1.21.0
Oct 07 08:26:47 ubuntu caddy[270620]: os.Getwd=/
Oct 07 08:26:47 ubuntu caddy[270620]: LANG=en_US.UTF-8
Oct 07 08:26:47 ubuntu caddy[270620]: PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
Oct 07 08:26:47 ubuntu caddy[270620]: NOTIFY_SOCKET=/run/systemd/notify
Oct 07 08:26:47 ubuntu caddy[270620]: HOME=/var/lib/caddy
Oct 07 08:26:47 ubuntu caddy[270620]: LOGNAME=caddy
Oct 07 08:26:47 ubuntu caddy[270620]: USER=caddy
Oct 07 08:26:47 ubuntu caddy[270620]: INVOCATION_ID=cc8e561be4374d73952f0b519134c33f
Oct 07 08:26:47 ubuntu caddy[270620]: JOURNAL_STREAM=8:28466630
Oct 07 08:26:47 ubuntu caddy[270620]: SYSTEMD_EXEC_PID=270620
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8008668,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"warn","ts":1696667207.8012938,"logger":"caddyfile","msg":"Using a path in a site address is deprecated; please use the 'handle' directive instead","address":"http://:6443/udp"}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.802933,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.803422,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000311500"}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8034494,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8036158,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/var/lib/caddy/.local/share/caddy"}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8036592,"logger":"tls","msg":"finished cleaning storage units"}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8063788,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Oct 07 08:26:47 ubuntu caddy[270620]: {"level":"info","ts":1696667207.8065386,"msg":"serving initial configuration"}
Oct 07 08:26:47 ubuntu systemd[1]: Started Caddy.
3. Caddy version:
root@ubuntu:~# caddy version
v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=
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:
Linux ubuntu 5.15.0-60-generic #66-Ubuntu SMP Fri Jan 20 14:29:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
b. Command:
root@ubuntu:~# curl -k -v -# -o /tmp/BPS.pdf https://localhost:6443/
* Trying [::1]:6443...
* Connected to localhost (::1) port 6443
* ALPN: curl offers h2,http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* OpenSSL/3.0.10: error:0A00010B:SSL routines::wrong version number
* Closing connection
curl: (35) OpenSSL/3.0.10: error:0A00010B:SSL routines::wrong version number
d. My complete Caddy config:
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
:6443/udp {
# Set this path to your site's directory.
root * /var/www/html/
# Enable the static file server.
file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile