下載並安裝caddy:
curl https://getcaddy.com | bash -s hook.service,http.authz,http.cgi,http.cors,http.filemanager,http.git,http.hugo,http.login,http.minify,http.proxyprotocol,http.realip
安裝為服務
caddy -service install -conf /etc/Caddyfile
參考修改/etc/Caddyfile
demo.com:80 {
root /home/wwwroot/demo/dist
git {
repo git@git.oschina.net:demo/xxxx.git
path /home/wwwroot/demo
key /root/.ssh/id_rsa
then npm install
then npm run build
hook /webhook ibenchu
hook_type generic
}
gzip
# log /var/log/caddy/access.log
# errors /var/log/caddy/error.log
}
測試啟動(Ctrl+c
或者關閉終端會停止)
caddy -conf /etc/Caddyfile
注:
npm 編譯可能有點慢 (確認自己伺服器安裝了nodejs)
使用服務方式使用 (restart、stop)
caddy -service start
歡迎支援我們的開源專案: https://github.com/notadd/notadd
本作品採用《CC 協議》,轉載必須註明作者和本文連結