Hello, all! I’m new to Caddy, been only using Nginx for the past few months so bear with me, please!
I’m trying to set up a WordPress installation I’ve been using with Nginx with Caddy. The Docker I’m using currently is this one:
I used the php variant because I don’t know if WordPress uses php or not (or whether I need it in the first place), but it seemed like a good idea because I’m also going to set up _h5ai similarly later.
What I’m having trouble with is the configuration of the Caddyfile. In the past (Nginx), I used this configuration:
# Main server block (for wordpress)
server {
listen 443 ssl;
root /config/www/wordpress;
index index.html index.htm index.php;
server_name example.com www.example.com;
ssl_certificate /config/keys/fullchain.pem;
ssl_certificate_key /config/keys/privkey.pem;
ssl_dhparam /config/nginx/dhparams.pem;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
client_max_body_size 0;
location / {
try_files $uri $uri/ /index.html /index.php?$args =404;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
I read up on some files and managed to make this Caddyfile. But I’m not sure if this is correct.
example.com www.example.com {
tls example@gmail.com
root ./wordpress
log ./storage/logs/caddy-access.log
errors ./storage/logs/caddy-error.log
fastcgi / unix:/var/run/php5-fpm.sock {
index index.php
}
rewrite {
to {path} {path}/ /index.php?{query}
}
}
This is the error I can see on the Docker logs. Note that I’m using UnRAID with a customized Docker.
2016/11/24 07:40:14 get directory at 'https://acme-v01.api.letsencrypt.org/directory': failed to get "https://acme-v01.api.letsencrypt.org/directory": Get https://acme-v01.api.letsencrypt.org/directory: x509: failed to load system roots and no roots provided
Activating privacy features...
It spits this out, then shuts down. When I try to restart it, the above log repeats, and it shuts down.
I have another question as well. With Nginx and LetsEncrypt, I was unable to use CloudFlare because Letsencrypt wouldn’t give me a certificate because the IP didn’t match or something. Can I use CloudFlare with this Docker image?
How do I configure Caddy? What am I doing wrong? Can I use CF? Thanks in advance.

The whole platform is based on it. You’re also going to need to set up MySQL or MariaDB. You might be better served, actually, by having an official WordPress container with a paired MariaDB container and simply proxying to your WP via Caddy. It’d probably be simpler.

Got that solved. You can reboot your UnRAID server, rest assured. It was a mess-up on my part.