August 2019 Archives

Caddy Web Server

user-pic
Vote 0 Votes

Caddy Web Server 目的是簡化 SSL 憑證的設定, 它可以做到自動化,
甚至可以幫你自動 Renew, 設定也很簡單, 很適合用在小型網站或測試、開發環境
在網站上選擇好 Plugins 後, 會產生一行安裝指令(如下面這行), 執行後會執行檔會在 /usr/local/bin/caddy,
它是 Go 寫的, 這個執行檔不需要其他相依的 Library
curl https://getcaddy.com | bash -s personal hook.service,http.authz,http.cache,http.expires,http.ipfilter,http.locale,http.login
其中 hook.service 是用來建立服務用的 (-service參數)

建立 Caddy config 及 log 目錄
mkdir /etc/caddy /var/log/caddy

Caddy config 範例檔 /etc/caddy/Caddyfile
有兩個域名, 都有 PHP (需跑 php-fpm 服務)
domain1.com 使用自動憑證, 有開 https 及 http, http 有加 rewrite rule
domain2.com 使用現有憑證, 只開 https

建立服務、啟用、啟動
caddy -service install -agree=true -http2 -quic -log /var/log/caddy/caddy.log -conf=/etc/caddy/Caddyfile
systemctl enable caddy
systemctl start caddy

Recent Entries

About this Archive

This page is an archive of entries from August 2019 listed from newest to oldest.

July 2019 is the previous archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives