2020年5月

安装 docker

curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh

改变目录权限

chown -R 1000.1000 /home/caddy/www

配置 Caddyfile

hantu.win {
    tls [email protected]
    root /srv
    header / Strict-Transport-Security "max-age=31536000;"
    gzip
    log /root/hantu_win.log
    fastcgi / 127.0.0.1:9000 php
    on startup php-fpm7
}

www.hantu.win {
    redir https://hantu.win{uri}
}
blog.hantu.win {
    redir https://hantu.win{uri}
}

docker 运行

docker run -d \
--name=caddy \
--restart=always \
-e ACME_AGREE=true \
-v /home/caddy/Caddyfile:/etc/Caddyfile \
-v /home/caddy/.caddy:/root/.caddy \
-v /home/caddy/www:/srv \
-p 80:80 -p 443:443 -p 2015:2015 \
abiosoft/caddy:php