支持 caddy 2.4.6.

Signed-off-by: chen.yang <chen.yang@yuzhen-iot.com>
This commit is contained in:
chen.yang 2022-04-19 15:05:00 +08:00
parent ac5cf1dcbe
commit 0377755d7f
1 changed files with 18 additions and 43 deletions

View File

@ -26,7 +26,7 @@ Type=simple
User=<UserName>
Group=<UserName>
WorkingDirectory=/home/<UserName>/bin/caddy
ExecStart=/home/<UserName>/bin/caddy/caddy -conf /home/<UserName>/bin/caddy/Caddyfile
ExecStart=/home/<UserName>/bin/caddy/caddy run -config /home/<UserName>/bin/caddy/Caddyfile
Restart=always
Environment=USER=<UserName> HOME=/home/<UserName> GITEA_WORK_DIR=/home/<UserName>/bin/caddy
# If you want to bind Gitea to a port below 1024 uncomment
@ -39,57 +39,32 @@ Environment=USER=<UserName> HOME=/home/<UserName> GITEA_WORK_DIR=/home/<UserName
WantedBy=multi-user.target
```
然后使用 systemctl 进行使能和开启。
然后使用 systemctl 进行使能和开启。
Caddyfile 文件内容如下
```ini
10.20.0.33:2080/acrn/ {
root /home/autoai/Workspace/Caddy/repo/projectacrn.github.io
index index.html
git {
repo git@github.com:projectacrn/projectacrn.github.io.git
path /home/autoai/Workspace/Caddy/repo/projectacrn.github.io
branch master
key /home/autoai/.ssh/id_rsa
interval 172800
}
# Hugo 博客,使用 /home/rick/WebSer/Hugo/public/index.html 文件
:8004 {
root * /home/rick/WebSer/Hugo/public
file_server
}
10.20.0.33:2080/sbl/ {
root /home/autoai/Workspace/Caddy/repo/slimbootloader.github.io
index index.html
git {
repo git@github.com:slimbootloader/slimbootloader.github.io.git
path /home/autoai/Workspace/Caddy/repo/slimbootloader.github.io
branch master
key /home/autoai/.ssh/id_rsa
interval 172800
}
}
10.20.0.33:2080/celadon/ {
root /home/autoai/Workspace/Caddy/repo/celadon-documentation/_build/html
index index.html
git {
repo git@github.com:projectceladon/celadon-documentation.git
path /home/autoai/Workspace/Caddy/repo/celadon-documentation
branch master
key /home/autoai/.ssh/id_rsa
interval 172800
then make html
}
}
10.20.0.33:2080/download.clearlinux/ {
root /home/autoai/Workspace/Caddy/repo/download.clearlinux.org
index index.html
# 文件浏览
:6005 {
root * ./
file_server browse
}
```
其中:
* rootThe root path of the site.
* file_serverA static file server. It works by appending the request's URI path to the site's root path.
* browseenables file listings for requests to directories that do not have an index file.
## HTTPS
TLS 必须满足以下要求才能保证 HTTPS 功能正常:
TLS 必须满足以下要求才能保证 HTTPS 功能正常:
* The hostname:
* is not empty
@ -105,7 +80,7 @@ TLS 必须满足以下要求才能保证 HTTPS 功能正常:
## 修改 self signed 期限
修改如下代码:
修改如下代码:
```go
selfsigned.go:47:notAfter = notBefore.Add(24 * time.Hour * 7)