1
0
mirror of https://github.com/sendevia/website.git synced 2026-03-05 23:32:45 +08:00

feat: add Caddyfile

This commit is contained in:
2026-03-05 22:53:08 +08:00
parent 67a26def4f
commit d489bf24c4

37
Caddyfile Normal file
View File

@@ -0,0 +1,37 @@
:80 {
# 根目录指向构建产物
root * /app
# 关闭访问日志
log {
output discard
}
# 启用压缩
encode gzip zstd
# 文件服务器配置
try_files {path} {path}.html {path}/
file_server
# 错误页面处理
handle_errors {
@404 {
expression {http.error.status_code} == 404
}
@403 {
expression {http.error.status_code} == 403
}
rewrite @404 /404.html
rewrite @403 /404.html
file_server
}
# 静态资源缓存配置
@assets {
path /assets/*
}
header @assets {
Cache-Control "public, immutable, max-age=31536000"
}
}