use www-data user run caddy

This commit is contained in:
233boy
2018-04-03 12:53:08 +08:00
parent fa9fd183fe
commit 5878357a3e
2 changed files with 23 additions and 7 deletions

View File

@@ -705,18 +705,26 @@ install_caddy() {
echo -e "$red 安装 Caddy 出错!" && exit 1
fi
setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/caddy
if [[ $systemd ]]; then
cp -f ${caddy_tmp}init/linux-systemd/caddy.service /lib/systemd/system/
sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
# sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
systemctl enable caddy
else
cp -f ${caddy_tmp}init/linux-sysvinit/caddy /etc/init.d/caddy
sed -i "s/www-data/root/g" /etc/init.d/caddy
# sed -i "s/www-data/root/g" /etc/init.d/caddy
chmod +x /etc/init.d/caddy
update-rc.d -f caddy defaults
fi
mkdir -p /etc/ssl/caddy
if [ -z "$(grep www-data /etc/passwd)" ]; then
useradd -M -s /usr/sbin/nologin www-data
fi
chown -R www-data.www-data /etc/ssl/caddy
mkdir -p /etc/caddy/
rm -rf $caddy_tmp
caddy_config
@@ -761,9 +769,9 @@ install_v2ray() {
# $cmd install -y lrzsz git zip unzip curl wget qrencode bind-utils iptables-services
# fi
if [[ $cmd == "apt-get" ]]; then
$cmd install -y lrzsz git zip unzip curl wget qrencode
$cmd install -y lrzsz git zip unzip curl wget qrencode libcap2-bin
else
$cmd install -y lrzsz git zip unzip curl wget qrencode iptables-services
$cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services
fi
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime