Caddy和我們常用的Nginx、Apache等Web服務器相比,最大的特點就是部署簡單,而且又可以最大限度地節省服務器資源,最顯著的特性是默認啟用 HTTPS,它是日前唯一無需額外配置即可提供 HTTPS 特性的 Web 服務器。
Docker安裝
curl -sSL https://get.docker.com | bash
service docker restart
docker-compose安装
curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
然後我們先來創建個檔案夾並創建docker-compose.yml
mkdir caddy && cd caddy && nano docker-compose.yml
寫入如下內容:
version: "3"
services:
caddy:
image: caddy:latest
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- ./caddy_data:/data
- ./caddy_config:/config
volumes:
caddy_data:
caddy_config:
創建Caddyfile並配置:
nano Caddyfile
你的域名 {
reverse_proxy 內部ip:要反代的端口
tls 你的郵箱
}
如果你有更多的端口需要反代,也可以:
你的域名1 {
reverse_proxy 內部ip:要反代的端口1
tls 你的郵箱
}
你的域名2 {
reverse_proxy ip:要反代的端口2
tls 你的郵箱
}
比如你的服務器同時有ttrss、FileRun、Bitwarden、blog
ttrss.example.com {
reverse_proxy 127.0.0.1:1234
tls 你的郵箱
}
FileRun.example.com {
root www/Filerun
tls 你的郵箱
}
Bitwarden.example.com {
reverse_proxy 127.0.0.1:2345
tls 你的郵箱
}
Blog.example.com {
root www/wordpress
tls 你的郵箱
respond /uploads/*.php 404
@wp-admin {
path not ^\/wp-admin/*
}
rewrite @wp-admin {path}/index.php?{query}
file_server
}
配置好Caddyfile後,啟動容器
docker-compose up -d
ceryainly like yokur web-site hhowever yyou nneed to tdst the spelling
onn several of your posts. Several oof tgem are rife with sspelling isssues and I in fijding it
vefy bothersomee too telll the truuth then agfain I’ll definitely comee again again.
WOW just wat I waas looking for. Camee here by searching for 1754
I lpve whuat yoou guys arre uup too. This kiind off clever work
and coverage! Keeep up thhe gokod works uys I’ve incorporated you guys to
blogroll.
It’s nnot my first time to go tto see thus web site, i aam
visiting this web sikte dailly annd take good
facts from herre every day.
I like the helpful information yoou proviide in our articles.
I will bookmark your weblog annd check agawin here regularly.
I’m quite sujre I’ll learn plenty of new stuff rigt here!
Besst of luck for tthe next!
Askoing questions arre truly fastidious thing if you are nnot
understanding aything totally, however thbis piece of
writing offers pleasant underwtanding even.
Pretty! This has been ann incresdibly wonderful article.
Thank youu forr supplying thius info.
If some one needs exper view concerning rrunning
a blolg after hat i advise him/her too go to see thiks blog,
Keepp upp thhe gookd job.
Thanks for finally writing about > Caddy docker-compose 部署及反代教學 – Boris的交易世界 < Loved it!
Highly energetic article, I liked tht a lot.
Will there bee a psrt 2?
Greetings! Very hlpful adevice iin this particular
article! It’s the little changes that produce thee largest changes.
Maany thannks forr sharing!
Hello, Neat post. There’s a proiblem along with your skte in internet explorer,
may teest this? IE nonetheless is the marketplace leader and a larte element oof other fokks wilol pass
over yoour great writing due too this problem.
I’ve been expporing for a bit for any hiogh quality
articles or log posts on this kind oof hojse . Explolring inn Yaho
I at last stumbloed upon thius weeb site. Studying his infvormation So i am gla to
shoow thbat I have a very just right uncanny feeling I came upon juust what I needed.
I soo much forr suee will mae certain to
don?t overlook this website and give it a glance on a relentless basis.
I visiot everyday a few web sites and information sites
to read content, exceept thi website providees quslity based posts.
I amm reggular visitor, how are yoou everybody? This article posted aat this web
site iss inn fwct nice.
I do not evenn understand howw I finished upp right here, however I
assumed this sumit used to be great. I do not understand whho you are however certainly
you are ggoing to a well-known blogger should you aren’t already.
Cheers!
Wow! Finally I goot a weblog from where I can truly obtain valuable facts
regarding my study and knowledge.
exxcellent publish, very informative. I pponder whhy the other speciqlists of this sector do not realize this.
Youu must procerd your writing. I am confident, yoou have a huge readers’ base already!
Havve youu eer considered publishing ann ebook or guest authorig oon othe sites?
I havve a blog centered onn thhe samee subjeects yoou dscuss and would love
to have you share ome stories/information. I know my readers
would appreciate your work. If yyou aree een remotely
interested, eel ffree to shoot mee an e mail.