Caddy

Caddy

安装 — Caddy v2中文文档 (dengxiaolong.com)

与Nginx一样,Caddy也可以实现域名反代

我们通过使用CaddyFile的方式,来实现域名反代

Caddyfile 快速入门 — Caddy v2中文文档 (dengxiaolong.com)

Caddy的配置文件: /etc/caddy/caddyfile

# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.

blog.170827.xyz:80 {
    encode gzip
    reverse_proxy localhost:8090
}
webdav.170827.xyz:80 {
    encode gzip
    reverse_proxy localhost:8060
}
zfile.170827.xyz:80 {
    encode gzip
    reverse_proxy localhost:8100
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile

Cloudflare中,我们将三个二级域名解析到同一台服务器

通过Caddy,我们将不同端口的应用分别反代到不同的二级域名上