xcaddy run --config ./caddy.json
refer to Extending Caddy
- Install xcaddy
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
- Build A New Caddy Binary
xcaddy build master --with github.com/crackeer/caddy-database
- copy new template.html
here is the template.html
apps.http.servers下的一个配置
{
"admin": {
"disabled": false,
"listen": "0.0.0.0:2019",
"enforce_origin": false,
"origins": [
""
]
},
"apps": {
"http": {
"servers": {
"static": {
"idle_timeout": 30000000000,
"listen": [
"0.0.0.0:8080"
],
"max_header_bytes": 10240000,
"read_header_timeout": 10000000000,
"routes": [
{
"match": [
{
"header": {
"proxy": [
"database"
]
}
}
],
"handle": [
{
"handler": "database",
"driver": "mysql",
"dsn": "USER:PASSWORD@tcp(HOST:PORT)/DATABASE?charset=utf8mb4&parseTime=True&loc=Local"
}
],
"terminal": true
}
]
}
}
}
}
}
token
:username
:create_dir
/put_file
/delete_file
There are three actions you can config in user_config
- create_dir
- put_file
- delete_file
- Add create directory in current directory、upload file to current directory、delete file or empty directory
attention!!!
you have to set your token which represents your identity that make you have access to the three actions, you can click set token
at the bottom of the page.