Caddy 一个强大、Api Server, 一键Https, 反向代理服务器
官网: https://caddyserver.com/docs
ApiServer
- 创建一个文件
Caddyfile
- 运行命令
caddy start
- 提示安装证书 允许或拒绝 (一键Https)
- 打开浏览器
https:localhost
或http:localhost
admin api
http://localhost:2019
localhost { respond "Hello, world!" }
file server
如下包括 encode zstd gzip
templates 可以解析html 模板内的一些语法
file_server 开启文件服务器
localhost {
encode zstd gzip
templates
file_server browse
}
玩点花的
- 开启文件服务器到 80端口
- 8080 端口访问 hello 返回字符串
- 8081 反向代理 8080 端口
- 8082 只开启 http
8083 只开启 https
localhost { encode zstd gzip templates file_server browse } localhost:8080 { respond /health-check 200 respond /hello "Hello, world! 8080" 200 } localhost:8081 { reverse_proxy https://localhost:8080 } http://localhost:8082 { reverse_proxy https://localhost:8080 } https://localhost:8083 { reverse_proxy https://localhost:8080 }
如何给自己的服务器装上 Https
- yum install yum-plugin-copr
- yum copr enable @caddy/caddy
- yum install caddy
- touch Caddyfile
vim Caddyfile
6.baidu.com { respond "Hello, world!" }
- caddy start
就是如此的 Easy
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。