diff --git a/README.md b/README.md index b70692002..390eb52e5 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,8 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443: * nezha保存优化。 * OP防火墙优化(站点配置-状态关闭后,不再防御)-已安装的,需要重载。 * 修复子目录绑定-伪静态问题。 +* [插件]docker - 添加IP地址池。 +* PHP下载中国优化。 ### JSDelivr安装地址 diff --git a/plugins/docker/index.html b/plugins/docker/index.html index 1e5831e04..ffcf912a6 100755 --- a/plugins/docker/index.html +++ b/plugins/docker/index.html @@ -40,6 +40,7 @@

自启动

容器列表

镜像列表

+

IP地址池

仓库

diff --git a/plugins/docker/index.py b/plugins/docker/index.py index 05fd1a8ce..259f008ed 100755 --- a/plugins/docker/index.py +++ b/plugins/docker/index.py @@ -443,7 +443,7 @@ def dockerLoginCheck(user_name, user_pass, registry): return False -def getDockerIpList(): +def getDockerIpListData(): # 取IP列表 path = getServerDir() ipConf = path + '/iplist.json' @@ -453,13 +453,63 @@ def getDockerIpList(): return iplist +def getDockerIpList(): + data = getDockerIpListData() + return mw.returnJson(True, 'ok!', data) + + +def dockerAddIP(): + # 添加IP + args = getArgs() + data = checkArgs(args, ['address', 'netmask', 'gateway']) + if not data[0]: + return data[1] + + path = getServerDir() + ipConf = path + '/iplist.json' + if not os.path.exists(ipConf): + iplist = [] + mw.writeFile(ipConf, json.dumps(iplist)) + + iplist = json.loads(mw.readFile(ipConf)) + ipInfo = { + 'address': args['address'], + 'netmask': args['netmask'], + 'gateway': args['gateway'], + } + iplist.append(ipInfo) + mw.writeFile(ipConf, json.dumps(iplist)) + return mw.returnJson(True, '添加成功!') + + +def dockerDelIP(): + # 删除IP + args = getArgs() + data = checkArgs(args, ['address']) + if not data[0]: + return data[1] + + path = getServerDir() + ipConf = path + '/iplist.json' + if not os.path.exists(ipConf): + return mw.returnJson(False, '指定的IP不存在。!') + iplist = json.loads(mw.readFile(ipConf)) + newList = [] + for ipInfo in iplist: + if ipInfo['address'] == args['address']: + continue + newList.append(ipInfo) + mw.writeFile(ipConf, json.dumps(newList)) + return mw.returnJson(True, '成功删除!') + + def getDockerCreateInfo(): # 取创建依赖 import psutil data = {} data['images'] = imageList() data['memSize'] = int(psutil.virtual_memory().total / 1024 / 1024) - data['iplist'] = getDockerIpList() + data['iplist'] = getDockerIpListData() return mw.returnJson(True, 'ok!', data) @@ -653,6 +703,12 @@ if __name__ == "__main__": print(dockerPullReg()) elif func == 'image_list': print(imageListData()) + elif func == 'docker_get_iplist': + print(getDockerIpList()) + elif func == 'docker_del_ip': + print(dockerDelIP()) + elif func == 'docker_add_ip': + print(dockerAddIP()) elif func == 'get_docker_create_info': print(getDockerCreateInfo()) elif func == 'docker_create_con': diff --git a/plugins/docker/js/docker.js b/plugins/docker/js/docker.js index 571a6ce77..4d5cfc98c 100755 --- a/plugins/docker/js/docker.js +++ b/plugins/docker/js/docker.js @@ -468,7 +468,7 @@ function pullImages(tag, id){ function dockerImageListRender(){ dPost('image_list', '', {}, function(rdata){ var rdata = $.parseJSON(rdata.data); - console.log(rdata); + // console.log(rdata); if (!rdata.status){ layer.msg(rdata.msg,{icon:2,time:2000}); return; @@ -634,6 +634,87 @@ function dockerImageList(){ dockerImageListRender(); } +function deleteIpList(address){ + safeMessage('删除IP','你将删除从IP地址池['+address+'],确定?',function(){ + dPost('docker_del_ip','', {address:address},function(rdata){ + var rdata = $.parseJSON(rdata.data); + showMsg(rdata.msg,function(){ + if(rdata.status) { + dockerIpListRender(); + } + },{ icon: rdata.status ? 1 : 2 }); + }); + }); +} + +function dockerIpListRender(){ + dPost('docker_get_iplist', '', {}, function(rdata){ + var rdata = $.parseJSON(rdata.data); + // console.log(rdata); + if (!rdata.status){ + layer.msg(rdata.msg,{icon:2,time:2000}); + return; + } + + var list = ''; + var rlist = rdata.data; + + for (var i = 0; i < rlist.length; i++) { + + var op = ''; + op += '删除'; + + list += ''; + list += ''+rlist[i]['address']+''; + list += ''+rlist[i]['netmask']+''; + list += ''+rlist[i]['gateway']+''; + list += ''+op+''; + list += ''; + } + + $('#ip_list tbody').html(list); + }); +} + +function dockerAddIpPool(){ + var address = $('input[name="address"]').val(); + var netmask = $('input[name="netmask"]').val(); + var gateway = $('input[name="gateway"]').val(); + dPost('docker_add_ip','', {address:address,netmask:netmask,gateway:gateway}, function(rdata){ + var rdata = $.parseJSON(rdata.data); + showMsg(rdata.msg, function(){ + dockerIpListRender(); + },{icon:rdata.status?1:2}) + }); +} + +function dockerIpList(){ + var con = '
\ +
\ + \ + \ + \ + \ +
\ +
\ +
\ + \ + \ + \ + \ + \ + \ +
IP地址子网掩码网关操作
\ +
\ +
\ +
\ +
'; + + $(".soft-man-con").html(con); + + dockerIpListRender(); +} + // login function repoLogin(){ var _option1= ""; diff --git a/plugins/php/install.sh b/plugins/php/install.sh index d001f1909..bc54c8ff7 100755 --- a/plugins/php/install.sh +++ b/plugins/php/install.sh @@ -49,6 +49,7 @@ fi cd ${curPath} && sh -x $curPath/versions/$2/install.sh $1 + if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then #初始化 diff --git a/plugins/php/lib/freetype_new.sh b/plugins/php/lib/freetype_new.sh index cc67f77c8..5911efa75 100644 --- a/plugins/php/lib/freetype_new.sh +++ b/plugins/php/lib/freetype_new.sh @@ -15,11 +15,20 @@ SOURCE_ROOT=$rootPath/source/lib if [ ! -d ${SERVER_ROOT}/freetype ];then cd $SOURCE_ROOT - wget -O freetype-2.12.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz -T 5 - tar zxvf freetype-2.12.1.tar.gz - cd freetype-2.12.1 + + if [ ! -f $SOURCE_ROOT/freetype-2.12.1.tar.gz ];then + wget -O freetype-2.12.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz -T 5 + fi + + if [ ! -d $SOURCE_ROOT/freetype-2.12.1 ];then + tar zxvf freetype-2.12.1.tar.gz + cd freetype-2.12.1 + else + cd freetype-2.12.1 + fi + ./configure --prefix=${SERVER_ROOT}/freetype && make && make install - cd $SOURCE_ROOT + cd $SOURCE_ROOT && rm -rf freetype-2.12.1 #rm -rf freetype-2.12.1.tar.gz - #rm -rf freetype-2.12.1 + fi \ No newline at end of file diff --git a/plugins/php/lib/freetype_old.sh b/plugins/php/lib/freetype_old.sh index 234c87a52..256bebec5 100644 --- a/plugins/php/lib/freetype_old.sh +++ b/plugins/php/lib/freetype_old.sh @@ -15,11 +15,20 @@ SOURCE_ROOT=$rootPath/source/lib if [ ! -d ${SERVER_ROOT}/freetype_old ];then cd $SOURCE_ROOT - wget -O freetype-2.7.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz -T 5 - tar zxvf freetype-2.7.1.tar.gz - cd freetype-2.7.1 + + if [ ! -f $SOURCE_ROOT/freetype-2.7.1.tar.gz ];then + wget -O freetype-2.7.1.tar.gz --no-check-certificate https://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz -T 5 + fi + + if [ ! -d $SOURCE_ROOT/freetype-2.7.1 ];then + tar zxvf freetype-2.7.1.tar.gz + cd freetype-2.7.1 + else + cd freetype-2.7.1 + fi + ./configure --prefix=${SERVER_ROOT}/freetype_old && make && make install - #cd $SOURCE_ROOT + cd $SOURCE_ROOT && rm -rf freetype-2.7.1 + #rm -rf freetype-2.7.1.tar.gz - #rm -rf freetype-2.7.1 fi \ No newline at end of file diff --git a/plugins/php/versions/52/install.sh b/plugins/php/versions/52/install.sh index ded307b6c..f2bea957b 100755 --- a/plugins/php/versions/52/install.sh +++ b/plugins/php/versions/52/install.sh @@ -24,6 +24,22 @@ mkdir -p $serverPath/php cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.gz https://museum.php.net/php5/php-${version}.tar.gz fi diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh index 83da04c22..5198d9c82 100755 --- a/plugins/php/versions/53/install.sh +++ b/plugins/php/versions/53/install.sh @@ -24,6 +24,22 @@ mkdir -p $serverPath/php cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz fi diff --git a/plugins/php/versions/54/install.sh b/plugins/php/versions/54/install.sh index f8ba08bc4..ab9baaac1 100755 --- a/plugins/php/versions/54/install.sh +++ b/plugins/php/versions/54/install.sh @@ -24,6 +24,22 @@ mkdir -p $serverPath/php cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.gz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.gz https://museum.php.net/php5/php-${version}.tar.gz fi diff --git a/plugins/php/versions/55/install.sh b/plugins/php/versions/55/install.sh index 8ca947d58..2cf0168e4 100755 --- a/plugins/php/versions/55/install.sh +++ b/plugins/php/versions/55/install.sh @@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz fi diff --git a/plugins/php/versions/56/install.sh b/plugins/php/versions/56/install.sh index f1763b423..eb45b0bf3 100755 --- a/plugins/php/versions/56/install.sh +++ b/plugins/php/versions/56/install.sh @@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php5/php-${version}.tar.xz fi diff --git a/plugins/php/versions/70/install.sh b/plugins/php/versions/70/install.sh index 202352101..319b420d6 100755 --- a/plugins/php/versions/70/install.sh +++ b/plugins/php/versions/70/install.sh @@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz fi diff --git a/plugins/php/versions/71/install.sh b/plugins/php/versions/71/install.sh index faa521eec..da0c6db8c 100755 --- a/plugins/php/versions/71/install.sh +++ b/plugins/php/versions/71/install.sh @@ -23,6 +23,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz fi diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh index 53ddb8870..4b1256341 100755 --- a/plugins/php/versions/72/install.sh +++ b/plugins/php/versions/72/install.sh @@ -24,6 +24,22 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz fi diff --git a/plugins/php/versions/73/install.sh b/plugins/php/versions/73/install.sh index 8323bf429..088c8134a 100755 --- a/plugins/php/versions/73/install.sh +++ b/plugins/php/versions/73/install.sh @@ -28,6 +28,21 @@ cd ${rootPath}/plugins/php/lib && /bin/bash freetype_old.sh cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index 560e4348e..0e94a635f 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -36,6 +36,21 @@ fi if [ ! -d $sourcePath/php/php${PHP_VER} ];then + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz fi diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh index ae22c5606..ab8d2ed9b 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -35,6 +35,22 @@ if [ "$?" == "0" ];then fi if [ ! -d $sourcePath/php/php${PHP_VER} ];then + + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz diff --git a/plugins/php/versions/81/install.sh b/plugins/php/versions/81/install.sh index 5e95702c6..8c6cef457 100755 --- a/plugins/php/versions/81/install.sh +++ b/plugins/php/versions/81/install.sh @@ -36,6 +36,22 @@ fi if [ ! -d $sourcePath/php/php${PHP_VER} ];then + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz fi diff --git a/plugins/php/versions/82/install.sh b/plugins/php/versions/82/install.sh index 64044b4e2..be8a475a3 100755 --- a/plugins/php/versions/82/install.sh +++ b/plugins/php/versions/82/install.sh @@ -36,6 +36,22 @@ fi if [ ! -d $sourcePath/php/php${PHP_VER} ];then + # ----------------------------------------------------------------------- # + # 中国优化安装 + cn=$(curl -fsSL -m 10 -s http://ipinfo.io/json | grep "\"country\": \"CN\"") + LOCAL_ADDR=common + if [ ! -z "$cn" ];then + LOCAL_ADDR=cn + fi + + if [ "$LOCAL_ADDR" == "cn" ];then + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then + wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://mirrors.sohu.com/php/php-${version}.tar.xz + fi + fi + # ----------------------------------------------------------------------- # + + if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz fi diff --git a/scripts/install/rhel.sh b/scripts/install/rhel.sh index a0c47d92c..6cff22d3c 100644 --- a/scripts/install/rhel.sh +++ b/scripts/install/rhel.sh @@ -97,6 +97,7 @@ if [ ! -f /usr/sbin/firewalld ];then # look # firewall-cmd --list-all + # systemctl status firewalld if [ "$SSH_PORT" != "" ];then firewall-cmd --permanent --zone=public --add-port=${SSH_PORT}/tcp