|
|
@ -2,6 +2,9 @@ _download_caddy_file() { |
|
|
|
caddy_tmp="/tmp/install_caddy/" |
|
|
|
caddy_tmp="/tmp/install_caddy/" |
|
|
|
caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz" |
|
|
|
caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz" |
|
|
|
[[ -d $caddy_tmp ]] && rm -rf $caddy_tmp |
|
|
|
[[ -d $caddy_tmp ]] && rm -rf $caddy_tmp |
|
|
|
|
|
|
|
if [[ ! ${caddy_arch} ]]; then |
|
|
|
|
|
|
|
echo -e "$red 获取 Caddy 下载参数失败!$none" && exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
local caddy_download_link="https://caddyserver.com/download/linux/${caddy_arch}?license=personal" |
|
|
|
local caddy_download_link="https://caddyserver.com/download/linux/${caddy_arch}?license=personal" |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p $caddy_tmp |
|
|
|
mkdir -p $caddy_tmp |
|
|
@ -33,15 +36,19 @@ _install_caddy_service() { |
|
|
|
update-rc.d -f caddy defaults |
|
|
|
update-rc.d -f caddy defaults |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p /etc/ssl/caddy |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -z "$(grep www-data /etc/passwd)" ]; then |
|
|
|
if [ -z "$(grep www-data /etc/passwd)" ]; then |
|
|
|
useradd -M -s /usr/sbin/nologin www-data |
|
|
|
useradd -M -s /usr/sbin/nologin www-data |
|
|
|
fi |
|
|
|
fi |
|
|
|
chown -R www-data.www-data /etc/ssl/caddy |
|
|
|
# chown -R www-data.www-data /etc/ssl/caddy |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p /etc/caddy/ |
|
|
|
# ref https://github.com/caddyserver/caddy/tree/master/dist/init/linux-systemd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mkdir -p /etc/caddy |
|
|
|
|
|
|
|
chown -R root:root /etc/caddy |
|
|
|
|
|
|
|
mkdir -p /etc/ssl/caddy |
|
|
|
|
|
|
|
chown -R root:www-data /etc/ssl/caddy |
|
|
|
|
|
|
|
chmod 0770 /etc/ssl/caddy |
|
|
|
|
|
|
|
|
|
|
|
## create sites dir |
|
|
|
## create sites dir |
|
|
|
mkdir -p /etc/caddy/sites |
|
|
|
mkdir -p /etc/caddy/sites |
|
|
|
} |
|
|
|
} |
|
|
|