2023-02-12  2024-09-15    218 字  1 分钟

官方安装文档https://caddyserver.com/docs/install

Debian, Ubuntu, Raspbian

1apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
2curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
3curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list
4apt update
5apt install caddy

Compile

1go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
2~/go/bin/xcaddy build --with github.com/mholt/caddy-webdav --with github.com/aksdb/caddy-cgi/v2

Module

cgi

cgi模块:CGI能够让浏览者与服务器进行交互

在官网下载(或自行编译)可执行文件,替换掉bin目录下原有的caddy可执行文件 执行systemctl restart caddy

 1{
 2  order cgi last
 3}
 4
 5akvicor.com {
 6  encode gzip
 7  tls pem key
 8  reverse_proxy  localhost:8080 {
 9    header_up Host {host}
10    header_up X-Real-IP {remote}
11    header_up X-Forwarded-For {remote}
12    header_up X-Forwarded-Proto {scheme}
13  }
14}
15
16akvicor.com {
17    cgi /cgi-bin/mathtex.cgi /www/cgi-bin/mathtex.cgi
18    root * /www/wiki/mediawiki
19    encode gzip
20    php_fastcgi unix//run/php-fpm/www.sock
21    file_server
22}

除另有声明外本博客文章均采用 知识共享 (Creative Commons) 署名 4.0 国际许可协议 进行许可转载请注明原作者与文章出处