1. Caddy version (caddy version
):
Version: 2.2.1
2. How I run Caddy:
I am running caddy as the caddy user with the included systemd service file.
a. System environment:
I installed Caddy through apt @ https://apt.fury.io/caddy/ I am running Ubuntu server 20.04
c. Service/unit/compose file:
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
d. My complete Caddyfile or JSON config:
(osakacloudflare) {
tls /etc/caddy/osakachancert.pem /etc/caddy/osakachankey.pem
}
cloud.osakachan.com {
import osakacloudflare
root * /var/www/cloud
php_fastcgi unix//run/php/php-fpm.sock
log
}
3. The problem I’m having:
Hi, as you can see in my Caddyfile I am trying to get php working with caddy. the URL https://cloud.osakachan.com/ should load index.php but instead shows me my browser’s error page:
This site can’t be reached
cloud.osakachan.com’s server IP address could not be found.
DNS_PROBE_FINISHED_NXDOMAIN
4. Error messages and/or full log output:
Dec 03 20:43:41 tapewormparadise caddy[130498]: {"level":"info","ts":1607053421.3694196,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":""}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3736622,"logger":"admin.api","msg":"received request","method":"POST","host":"localhost:2019","uri":"/load","remote_addr":"127.0.0.1:45622","headers":{"Accept-Encoding":["gzip"],"Content-Length":["3773"],"Content-Type":["application/json"],"Origin":["localhost:2019"],"User-Agent":["Go-http-client/1.1"]}}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3754735,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.375803,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0005e4690"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"warn","ts":1607053421.3771682,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [cloudflare origin certificate *.osakachan.com osakachan.com]: no URL to issuing certificate"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3773098,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"nil.osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3773189,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"dfc.osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3773446,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"files.osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3773484,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"cloud.osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.3773527,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"www.osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.377356,"logger":"http","msg":"skipping automatic certificate management because one or more matching certificates are already loaded","domain":"osakachan.com","server_name":"srv0"}
Dec 03 20:43:41 tapewormparadise caddy[130325]: {"level":"info","ts":1607053421.377359,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Dec 03 20:43:42 tapewormparadise caddy[130325]: {"level":"info","ts":1607053422.3798795,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0005de540"}
Dec 03 20:43:42 tapewormparadise caddy[130325]: {"level":"info","ts":1607053422.3800747,"msg":"autosaved config","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Dec 03 20:43:42 tapewormparadise caddy[130325]: {"level":"info","ts":1607053422.3800824,"logger":"admin.api","msg":"load complete"}
Dec 03 20:43:42 tapewormparadise systemd[1]: Reloaded Caddy.
Dec 03 20:43:42 tapewormparadise caddy[130325]: {"level":"info","ts":1607053422.8757899,"logger":"admin","msg":"stopped previous server"}
5. What I already tried:
I have looked to see if maybe this was an issue of not configuring php correctly. I have edited the file /etc/php/7.4/fpm/pool.d/www.conf
and changed the user www-data
to caddy
I have also installed all of the following php packages php-cli php-fpm php-mysql php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-ldap php-zip php-curl
6. Links to relevant resources:
I have been using these guides as a reference