summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorheimoshuiyu2021-09-29 22:28:22 +0800
committerheimoshuiyu2021-09-29 22:28:22 +0800
commit5b31eca6272f06df7cc4f079855a48b481decb39 (patch)
tree147254fee98b788de1f10821f9e1cb1c71e617c3
downloadaur-5b31eca6272f06df7cc4f079855a48b481decb39.tar.gz
initial commit
-rw-r--r--.SRCINFO21
-rw-r--r--Caddyfile14
-rw-r--r--PKGBUILD55
-rw-r--r--caddy.service71
4 files changed, 161 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..9a3dc5b3d219
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = caddy-webdav-git
+ pkgdesc = HTTP/2 Web Server with Automatic HTTPS and webdav plugin
+ pkgver = 20210927.059fc32f
+ pkgrel = 1
+ url = https://giteub.com/caddyserver/caddy
+ arch = x86_64
+ license = Apache
+ makedepends = git
+ makedepends = go
+ depends = caddy
+ provides = caddy
+ conflicts = caddy
+ backup = etc/caddy/Caddyfile
+ source = caddy::git://github.com/caddyserver/caddy
+ source = Caddyfile
+ source = caddy.service
+ sha256sums = SKIP
+ sha256sums = bcec35e3a514dffed5aae314cded658dd5fbd534d30756941ad37298bf066ab8
+ sha256sums = 9bdd2741269a0ac2088f325ca7c08bfa01ddc707149e5027170bc8aeb83cf0aa
+
+pkgname = caddy-webdav-git
diff --git a/Caddyfile b/Caddyfile
new file mode 100644
index 000000000000..f4bb75c7585a
--- /dev/null
+++ b/Caddyfile
@@ -0,0 +1,14 @@
+{
+ order webdav before file_server
+}
+
+localhost {
+ rewrite /dav /dav/
+ webdav /some/path/match/* {
+ root /path
+ prefix /some/path/match
+ }
+ root * /srv/http
+ file_server
+}
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4a930780b67c
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,55 @@
+# Maintainer: hmsy <heimoshuiyu at gmail dot com>
+
+pkgname=caddy-webdav-git
+pkgver=20210927.059fc32f
+pkgrel=1
+pkgdesc='HTTP/2 Web Server with Automatic HTTPS and webdav plugin'
+arch=('x86_64')
+url="https://giteub.com/caddyserver/caddy"
+license=('Apache')
+depends=('caddy')
+makedepends=('git' 'go')
+provides=("caddy")
+conflicts=("caddy")
+backup=('etc/caddy/Caddyfile')
+
+source=("caddy::git://github.com/caddyserver/caddy"
+ "Caddyfile"
+ "caddy.service")
+sha256sums=('SKIP'
+ 'bcec35e3a514dffed5aae314cded658dd5fbd534d30756941ad37298bf066ab8'
+ '9bdd2741269a0ac2088f325ca7c08bfa01ddc707149e5027170bc8aeb83cf0aa')
+
+
+pkgver() {
+ cd "${srcdir}/caddy"
+ git log -1 --format='%cd.%h' --date=short | tr -d -
+}
+
+prepare() {
+ cd "${srcdir}/caddy/cmd/caddy/"
+ sed -e "/plug in Caddy modules here/a\\
+ _ \"github.com/mholt/caddy-webdav\"" < main.go > main.go.patched
+ cp main.go.patched main.go
+ rm main.go.patched
+}
+
+build() {
+ cd "${srcdir}/caddy/cmd/caddy"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+ rm -f go.mod
+ go mod init caddy
+ go mod tidy
+ go build -v .
+}
+
+package() {
+ cd "${srcdir}"
+ install -D -m 0755 caddy/cmd/caddy/caddy "${pkgdir}/usr/bin/caddy"
+ install -D -m 0644 caddy.service "${pkgdir}/usr/lib/systemd/system/caddy.service"
+ install -D -m 0644 Caddyfile "${pkgdir}/etc/caddy/Caddyfile"
+}
diff --git a/caddy.service b/caddy.service
new file mode 100644
index 000000000000..96259b46503d
--- /dev/null
+++ b/caddy.service
@@ -0,0 +1,71 @@
+# caddy.service
+#
+# For using Caddy with a config file.
+#
+# Make sure the ExecStart and ExecReload commands are correct
+# for your installation.
+#
+# See https://caddyserver.com/docs/install for instructions.
+#
+# WARNING: This service does not use the --resume flag, so if you
+# use the API to make changes, they will be overwritten by the
+# Caddyfile next time the service is restarted. If you intend to
+# use Caddy's API to configure it, add the --resume flag to the
+# `caddy run` command or use the caddy-api.service file instead.
+
+[Unit]
+Description=Caddy web server
+Documentation=https://caddyserver.com/docs/
+After=network-online.target
+Wants=network-online.target systemd-networkd-wait-online.service
+StartLimitIntervalSec=14400
+StartLimitBurst=10
+
+[Service]
+User=caddy
+Group=caddy
+Environment=XDG_DATA_HOME=/var/lib
+Environment=XDG_CONFIG_HOME=/etc
+ExecStartPre=/usr/bin/caddy validate --config /etc/caddy/Caddyfile
+ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
+ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
+ExecStopPost=/usr/bin/rm -f /run/caddy/admin.socket
+
+# Do not allow the process to be restarted in a tight loop. If the
+# process fails to start, something critical needs to be fixed.
+Restart=on-abnormal
+
+# Use graceful shutdown with a reasonable timeout
+TimeoutStopSec=5s
+
+LimitNOFILE=1048576
+LimitNPROC=512
+
+# Hardening options
+AmbientCapabilities=CAP_NET_BIND_SERVICE
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+DevicePolicy=closed
+LockPersonality=true
+MemoryAccounting=true
+MemoryDenyWriteExecute=true
+NoNewPrivileges=true
+PrivateDevices=true
+PrivateTmp=true
+ProcSubset=pid
+ProtectClock=true
+ProtectControlGroups=true
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelLogs=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+ProtectProc=invisible
+ProtectSystem=strict
+RemoveIPC=true
+ReadWritePaths=/var/lib/caddy /var/log/caddy /run/caddy
+RestrictNamespaces=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+
+[Install]
+WantedBy=multi-user.target