[Caddy2] Caddyfile 指令

通过llama.cpp与羊驼聊天的网页界面- 详解 Serge 的启动使用

 

以下是 Caddyfile 的标准指令。

acme_server An embedded ACME server
basicauth Enforces HTTP Basic Authentication
bind Customize the server's socket address
encode Encodes (usually compresses) responses
file_server Serve files from disk
handle A mutually-exclusive group of directives
handle_errors Defines routes for handling errors
handle_path Like handle, but strips path prefix
header Sets or removes response headers
import Include snippets or files
log Enables access/request logging
php_fastcgi Serve PHP sites over FastCGI
redir Issues an HTTP redirect to the client
request_header Manipulates request headers
respond Writes a hard-coded response to the client
reverse_proxy A powerful and extensible reverse proxy
rewrite Rewrites the request internally
root Set the path to the site root
route A group of directives treated literally as single unit
templates Execute templates on the response
tls Customize TLS settings
try_files Rewrite that depends on file existence
uri Manipulate the URI

 

 

指令的语法格式如下:

directive [<matcher>] <args...> {
    subdirective [<args...>]
}

< > 中使用实际的值替换,[ ] 代表是可选的参数,... 代表一个或多个值。

 

大多数指令接受 [<matcher>] 来过滤请求,表示不同的请求使用不同的指令。

 

许多指令操纵 HTTP 处理程序链。这些指令的求值顺序很重要,因此默认的顺序被硬编码到 Caddy 中。

root

header

redir
rewrite

uri
try_files

basicauth
request_header
encode
templates

handle
handle_path
route

respond
reverse_proxy
php_fastcgi
file_server
acme_server

如果需要自定义顺序,可以使用 order 全局选项,或者 route 指令。

 

Refer:所有Caddy2指令

Link:https://www.cnblogs.com/farwish/p/13100255.html

posted on 2020-06-12 16:28  ercom  阅读(2387)  评论(0编辑  收藏  举报