前言
Caddy自动配置HTTPS,配置简单,是Nginx的现代替代。
一、安装
curl -fsSL https://caddyserver.com/api/download?os=linux&arch=amd64 -o /usr/bin/caddy
二、Caddyfile配置
# 自动HTTPS,无需手动配置证书
example.com {
reverse_proxy localhost:3000
header {
X-Frame-Options DENY
X-Content-Type-Options nosniff
}
}
api.example.com {
reverse_proxy localhost:8080
log {
output file /var/log/caddy/api.log
}
}
总结
Caddy零配置HTTPS,适合现代Web部署。如需服务,欢迎联系17老师。
关于17老师:AI应用·数字化管理·全栈开发·网络安全全栈专家。邮箱:j.d88888888@qq.com 微信:AFIST17