开启、停用反向代理

Signed-off-by: HITSword <admin@huayizhiyun.com>
master
HITSword 2020-01-17 21:39:34 +08:00
parent 41a285055d
commit bdb45d126b
2 changed files with 20 additions and 3 deletions

View File

@ -62,10 +62,20 @@ function amh_module_admin()
php ${module_dir}cli.php --action='list';
;;
start)
echo "start something";
[ -f "/usr/local/nginx/conf/hyproxy/$domain.conf" ] && echo "[OK] $domain is ok" && exit;
RES=`php ${module_dir}cli.php --action='edit' --server_name=${domain} --field_name='status' --value='start'`;
if ! echo "$RES" | grep 'Error' > /dev/null; then
kill -HUP `cat /usr/local/nginx/logs/nginx.pid` && echo "[OK] successfully start $domain " && exit;
fi;
echo "[Error] $domain not exist!" && exit 1;
;;
stop)
echo "stop something";
[ ! -f "/usr/local/nginx/conf/hyproxy/$domain.conf" ] && echo "[OK] $domain already stopped" && exit;
RES=`php ${module_dir}cli.php --action='edit' --server_name=${domain} --field_name='status' --value='stop'`;
if ! echo "$RES" | grep 'Error' > /dev/null; then
kill -HUP `cat /usr/local/nginx/logs/nginx.pid` && echo "[OK] successfully stop $domain" && exit;
fi;
echo "[Error] $domain not exist!" && exit 1;
;;
add)
proxy_pass=$3;
@ -76,8 +86,14 @@ function amh_module_admin()
fi;
;;
edit)
#参数名
ParamName=$3
ParamVal=$4
#参数值
i=0;
for line in $*; do
i=$[$i+1];
[ "$i" -gt 3 ] && ParamVal="$ParamVal $line";
done;
RES=`php ${module_dir}cli.php --action='edit' --server_name=${domain} --field_name=${ParamName} --value=${ParamVal}`;
echo $RES;
if ! echo "$RES" | grep 'Error' > /dev/null; then

View File

@ -182,6 +182,7 @@
}
/**
* 【完成】
* 删除反向代理
* @param $server_name
* @return string