caddy-modern-config
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCaddy Modern Config
Caddy 现代配置
When to use this skill
何时使用此技能
- Configuring Caddy as a web server or reverse proxy.
- Setting up local HTTPS.
- Deploying PHP/Python apps with Caddy.
- 将Caddy配置为Web服务器或反向代理。
- 搭建本地HTTPS环境。
- 使用Caddy部署PHP/Python应用。
1. Caddyfile Basics
1. Caddyfile 基础
- Syntax: .
domain { directives } - Auto-HTTPS: Enabled by default for any host that looks like a domain.
- 语法:。
domain { directives } - 自动HTTPS:对于任何看起来像域名的主机,默认启用该功能。
2. Reverse Proxy
2. 反向代理
- Python/Node:
caddy
example.com { reverse_proxy localhost:3000 }
- Python/Node:
caddy
example.com { reverse_proxy localhost:3000 }
3. PHP (FastCGI)
3. PHP(FastCGI)
- Directives: Use preset.
php_fastcgicaddyexample.com { root * /var/www/site/public php_fastcgi unix//run/php/php8.3-fpm.sock file_server }
- 指令:使用预设。
php_fastcgicaddyexample.com { root * /var/www/site/public php_fastcgi unix//run/php/php8.3-fpm.sock file_server }
4. Security
4. 安全设置
- Headers: Add basic security headers easily.
caddy
header { Strict-Transport-Security "max-age=31536000;" X-Content-Type-Options "nosniff" }
- 请求头:轻松添加基础安全请求头。
caddy
header { Strict-Transport-Security "max-age=31536000;" X-Content-Type-Options "nosniff" }