1.安装部署
yum install yum-plugin-copr
yum copr enable @caddy/caddy
yum install caddy
2.配置caddy
mkdir /etc/caddy/ -p
cat > /etc/caddy/Caddyfile<<EOF
www.lizhiqiang.name {
root * /var/www/wordpress
encode gzip
php_fastcgi localhost:9000
file_server
}
EOF
3.设置开机自启
cat > caddy.service<<EOF
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=root
Group=root
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
EOF
mv caddy.service /usr/lib/systemd/system/
systemctl daemon-reload
systemctl enable caddy