Centos7安装Caddy
用caddy自动续签ssl太爽了, 之前编译安装太费心了,现在可以直接从epel安装.
但是如果要做4层协议转发,还是没有nginx效率强大.
Centos7
yum -y -q install epel-release
yum -y -q install caddy
配置文件(不能用于Caddy2)
https://yourdomain.com {
gzip
browse
tls [email protected] #email address
root /data/www/html
fastcgi / /run/php-fpm/www.sock php {
ext .php
split .php
index index.php
}
header / {
Strict-Transport-Security "max-age=31536000;"
}
}
caddy.example.com {
root /www/webroot
gzip
proxy / localhost:8088 {
header_upstream Host {host}
header_upstream X-Real-IP {remote}
header_upstream X-Forwarded-For {remote}
header_upstream X-Forwarded-Port {server_port}
header_upstream X-Forwarded-Proto {scheme}
}
header /images {
Cache-Control "public, max-age=31536000"
}
header (.css|.js)$ {
Cache-Control "public, max-age=31536000"
}
log /var/log/caddy_access.log
errors /var/log/caddy_error.log
}
http://caddy.example.com {
gzip
root /usr/share/caddy
}
https://caddy.example.com {
gzip
root /usr/share/caddy
}
import conf.d/*.conf