From a881a1ece0031e1dbeb0bd2ff8ef39e82488bf4b Mon Sep 17 00:00:00 2001 From: lion187 Date: Tue, 27 Nov 2018 15:10:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E6=96=87=E4=BB=B6=20Software?= =?UTF-8?q?/Application/Caddy=5F=E7=9A=84=E4=BD=BF=E7=94=A8.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Software/Application/Caddy_的使用.md | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Software/Application/Caddy_的使用.md diff --git a/Software/Application/Caddy_的使用.md b/Software/Application/Caddy_的使用.md new file mode 100644 index 0000000..4e2d81c --- /dev/null +++ b/Software/Application/Caddy_的使用.md @@ -0,0 +1,88 @@ +# Caddy 的使用 + +从 Caddy 官网下载对应系统的 caddy 程序,配置需要使用的插件,也可以从官网获得更详细指导信息。 + +编写系统服务,内容如下 + +```sh +[Unit] +Description=Caddy +After=syslog.target +After=network.target +#After=mysqld.service +#After=postgresql.service +#After=memcached.service +#After=redis.service + +[Service] +# Modify these two values and uncomment them if you have +# repos with lots of files and get an HTTP error 500 because +# of that +### +#LimitMEMLOCK=infinity +#LimitNOFILE=65535 +RestartSec=2s +Type=simple +User= +Group= +WorkingDirectory=/home//bin/caddy +ExecStart=/home//bin/caddy/caddy -conf /home//bin/caddy/Caddyfile +Restart=always +Environment=USER= HOME=/home/ GITEA_WORK_DIR=/home//bin/caddy +# If you want to bind Gitea to a port below 1024 uncomment +# the two values below +### +#CapabilityBoundingSet=CAP_NET_BIND_SERVICE +#AmbientCapabilities=CAP_NET_BIND_SERVICE + +[Install] +WantedBy=multi-user.target +``` + +然后使用 systemctl 进行使能和开启。 + +Caddyfile 文件内容如下 + +```sh +10.20.0.33:2080/acrn/ { + root /home/autoai/Workspace/Caddy/repo/projectacrn.github.io + index index.html + git { + repo git@github.com:projectacrn/projectacrn.github.io.git + path /home/autoai/Workspace/Caddy/repo/projectacrn.github.io + branch master + key /home/autoai/.ssh/id_rsa + interval 172800 + } +} + +10.20.0.33:2080/sbl/ { + root /home/autoai/Workspace/Caddy/repo/slimbootloader.github.io + index index.html + git { + repo git@github.com:slimbootloader/slimbootloader.github.io.git + path /home/autoai/Workspace/Caddy/repo/slimbootloader.github.io + branch master + key /home/autoai/.ssh/id_rsa + interval 172800 + } +} + +10.20.0.33:2080/celadon/ { + root /home/autoai/Workspace/Caddy/repo/celadon-documentation/_build/html + index index.html + git { + repo git@github.com:projectceladon/celadon-documentation.git + path /home/autoai/Workspace/Caddy/repo/celadon-documentation + branch master + key /home/autoai/.ssh/id_rsa + interval 172800 + then make html + } +} + +10.20.0.33:2080/download.clearlinux/ { + root /home/autoai/Workspace/Caddy/repo/download.clearlinux.org + index index.html +} +```