1. Caddy version (caddy version
):
v2.3.0 h1:fnrqJLa3G5vfxcxmOH/+kJOcunPLhSBnjgIvjXV/QTA=
2. How I run Caddy:
First installed caddy with following commands as root
user. Therefore, I did not use sudo
in following commands.
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/gpg/gpg.155B6D79CA56EA34.key' | sudo apt-key add -
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/cfg/setup/config.deb.txt?distro=debian&version=any-version' | sudo tee -a /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
After installation, caddy service ran which I verified by typing caddy
at the command prompt.
a. System environment:
Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-65-generic x86_64)
b. Command:
Using caddy service that started right after installation. I run following command after every Caddyfile update
caddy reload
c. Service/unit/compose file:
I'm not sure about this, sorry. I'm running uBuntu installation.
d. My complete Caddyfile or JSON config:
jatra.club, *.jatra.club {
root * /var/www/html
php_fastcgi unix//run/php/php8.0-fpm.sock
file_server
log {
output file /var/log/caddy/access.log
format console
}
}
3. The problem I’m having:
I’m developing a multi-tenant app that lets users map their subdomains and domains to relevant subdomain hosted on my server. That is -
https://mydomain.com
https://<user-created-subdomains>.mydomain.com
https://<user-subdomain>.userdomain.com
https://userdomain.com
… running my application as backend.
However, as @matt said, this is going to be a super-advanced configuration. I’d therefore like to start with a much simpler configuration that lets me have https
enabled on mydomain.com
and *.mydomain.com
; so that I can have any subdomain delivered via HTTPS
.
4. Error messages and/or full log output:
I could not get any log entries in the /var/log/caddy/access.log
. I tried changing the owner and group of the access.log file to caddy and also tried running systemctl restart systemd-journald.service
command as described in Caddy is not generating any logs when launched as a service · Issue #3943 · caddyserver/caddy · GitHub . However, I still do not get any log entries.
Looks like the first issue I need to solve is to get the access logs.
5. What I already tried:
I’ve created an /var/www/html/index.php
file and also installed php8. I’ve tried multiple configurations of Caddyfile and my latest attempt is mentioned above.
WIth above configuration, I got https://jatra.club
working. However, can’t get https://<subdomain>.jatra.club
working. It throws following error in browser-
subd.jatra.club sent an invalid response.
ERR_SSL_PROTOCOL_ERROR