命令
最后更新于:2022-04-02 02:56:25
[TOC]
## 常用命令
### adapt
对配置文件转转为json 输出
```
> cat Caddyfile
:2015
respond "helo"
> caddy adpat --config Caddyfile
{"apps":{"http":{"servers":{"srv0":{"listen":[":2015"],"routes":[{"handle":[{"body":"helo ","handler":"static_response"}]}]}}}}}
```
[配置适配器](https://caddyserver.com/docs/config-adapters)
可以用一下配置文件驱动
* [**caddyfile**](https://caddyserver.com/docs/caddyfile)(standard)
* [**nginx**](https://github.com/caddyserver/nginx-adapter)
* [**jsonc**](https://github.com/caddyserver/jsonc-adapter)
* [**json5**](https://github.com/caddyserver/json5-adapter)
* [**yaml**](https://github.com/iamd3vil/caddy_yaml_adapter)
* [**cue**](https://github.com/caddyserver/cue-adapter)
* [**toml**](https://github.com/awoodbeck/caddy-toml-adapter)
如 适配nginx
```
caddy run \
--config nginx.conf \
--adapter nginx
```
### run 前台启动
```
> caddy run --config Caddyfile
```
### start / stop / reload 守护进程
```
> caddy start --config Caddyfile
> caddy stop
```
reload 热更新配置
```
> caddy reload
```
';