diff --git a/README.md b/README.md index 1649467f2c..72bc7f449d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -### mdserver-web 0.9.7 +

+ logo +

mdserver-web

+

一款简单Linux面板服务

+

+ +### 简介 简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。 复制了后台管理界面,按照自己想要的方式写了一版。 @@ -61,6 +67,15 @@ PHP[53-72]支持phpMyAdmin[4.4.15] PHP[72-81]支持phpMyAdmin[5.2.0] ``` +# AD - VPS推荐 - 🙏 + +- [ZZZ评测](https://www.zzzvps.com/) + +| 服务商 | LOGO | 推广地址 | 优惠码 | +| ------------- |----------|-----------|-------| +| digitalvirt |[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/aff.php?aff=154) | https://digitalvirt.com/aff.php?aff=154 | 9SYDY7UH0U | +| 搬瓦工 |[![搬瓦工](https://bwh81.net/templates/organicbandwagon/images/logo.png)](https://bandwagonhost.com/aff.php?aff=54161) | https://bandwagonhost.com/aff.php?aff=54161 | BWH3HYATVBJW | + # Docker - 由[DDSRem](https://github.com/DDSRem)开发维护。 @@ -71,10 +86,19 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443: ``` -### 版本更新 0.9.7 +### 版本更新 0.9.9 + +* 更换Logo。 +* 增加amazon linux系统支持。 +* 修复rsyncd在debian或ubuntu下安装失败问题。 +* Readme加入一AD。 +* PHP-YUM|PHP-APT优化[性能调整]。 +* 优化Gogs使用MySQL的方式。 +* 配置模板添加一个whmcs。 +* MySQL和MariaDB无法直接卸载。 +* OpenResty加入http_realip_module模块。 +* PHP加入igbinary扩展。 -* haproxy插件添加. -* 细节优化. ### JSDelivr安装地址 @@ -120,9 +144,19 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/qu ``` curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install_dev.sh | bash curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash + + +curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_dev.sh | bash +curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/update_dev.sh | bash ``` +### 捐赠地址 USDT(TRC20) + +TVbNgrpeGBGZVm5gTLa21ADP7RpnPFhjya + + ### 微信赞助 + [![截图](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg) @@ -138,7 +172,7 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up ### 感谢开发赞助 -[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/) +[![digitalvirt](https://digitalvirt.com/templates/BlueWhite/img/logo-dark.svg)](https://digitalvirt.com/aff.php?aff=154) ### 授权许可 diff --git a/class/core/config_api.py b/class/core/config_api.py index e4a848a54e..72197f5c9d 100755 --- a/class/core/config_api.py +++ b/class/core/config_api.py @@ -15,7 +15,7 @@ class config_api: - __version = '0.9.7' + __version = '0.9.9' def __init__(self): pass diff --git a/class/core/site_api.py b/class/core/site_api.py index 830f79ee3d..40f1ac30d4 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -497,7 +497,7 @@ def setCertToSiteApi(self): certName = request.form.get('certName', '') siteName = request.form.get('siteName', '') try: - path = self.sslDir + siteName + path = self.sslDir + siteName.strip() if not os.path.exists(path): return mw.returnJson(False, '证书不存在!') diff --git a/class/plugin/orm.py b/class/plugin/orm.py index 49bc65c187..f2b949c546 100755 --- a/class/plugin/orm.py +++ b/class/plugin/orm.py @@ -68,6 +68,9 @@ def setCharset(self, charset): def setPort(self, port): self.__DB_PORT = port + def setUser(self, user): + self.__DB_USER = user + def setPwd(self, pwd): self.__DB_PASS = pwd diff --git a/class/plugin/ormDb.py b/class/plugin/ormDb.py index f747c651df..14624ccc06 100755 --- a/class/plugin/ormDb.py +++ b/class/plugin/ormDb.py @@ -77,6 +77,12 @@ def setPwd(self, pwd): def getPwd(self): return self.__DB_PASS + def setDbName(self, name): + self.__DB_NAME = name + + def setUser(self, user): + self.__DB_USER = user + def execute(self, sql): # 执行SQL语句返回受影响行 if not self.__Conn(): diff --git a/plugins/gogs/class/mysqlDb.py b/plugins/gogs/class/mysqlDb.py deleted file mode 100755 index 4ce57da67b..0000000000 --- a/plugins/gogs/class/mysqlDb.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -import re -import os -import sys - -# sys.path.append("/usr/local/lib/python3.6/site-packages") - - -class mysqlDb: - __DB_PASS = None - __DB_USER = 'root' - __DB_PORT = 3306 - __DB_HOST = 'localhost' - __DB_NAME = 'test' - __DB_CONN = None - __DB_CUR = None - __DB_ERR = None - __DB_CNF = '/etc/my.cnf' - - def __Conn(self): - '''连接MYSQL数据库''' - try: - socket = '/www/server/mysql/mysql.sock' - try: - import MySQLdb - except Exception as ex: - self.__DB_ERR = ex - return False - try: - self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS, - port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket) - except MySQLdb.Error as e: - self.__DB_HOST = '127.0.0.1' - self.__DB_CONN = MySQLdb.connect(host=self.__DB_HOST, user=self.__DB_USER, passwd=self.__DB_PASS, - port=self.__DB_PORT, db=self.__DB_NAME, charset="utf8", connect_timeout=10, unix_socket=socket) - self.__DB_CUR = self.__DB_CONN.cursor() - return True - - except MySQLdb.Error as e: - self.__DB_ERR = e - return False - - def setHost(self, host): - self.__DB_HOST = host - - def setPwd(self, pwd): - self.__DB_PASS = pwd - - def setUser(self, user): - self.__DB_USER = user - - def setPort(self, port): - self.__DB_PORT = port - - def setDb(self, name): - self.__DB_NAME = name - - def getPwd(self): - return self.__DB_PASS - - def execute(self, sql): - # 执行SQL语句返回受影响行 - if not self.__Conn(): - return self.__DB_ERR - try: - result = self.__DB_CUR.execute(sql) - self.__DB_CONN.commit() - self.__Close() - return result - except Exception as ex: - return ex - - def query(self, sql): - # 执行SQL语句返回数据集 - if not self.__Conn(): - return self.__DB_ERR - try: - self.__DB_CUR.execute(sql) - result = self.__DB_CUR.fetchall() - # 将元组转换成列表 - # data = map(list, result) - self.__Close() - return result - except Exception as ex: - return "error: " + str(ex) - - # 关闭连接 - def __Close(self): - self.__DB_CUR.close() - self.__DB_CONN.close() diff --git a/plugins/gogs/index.py b/plugins/gogs/index.py index 7450d39933..8985144773 100755 --- a/plugins/gogs/index.py +++ b/plugins/gogs/index.py @@ -31,9 +31,6 @@ def getPluginName(): def getPluginDir(): return mw.getPluginDir() + '/' + getPluginName() -sys.path.append(getPluginDir() + "/class") -import mysqlDb - def getServerDir(): return mw.getServerDir() + '/' + getPluginName() @@ -235,16 +232,19 @@ def getDbConfValue(): def pMysqlDb(conf): - host = conf['HOST'].split(':') - conn = mysqlDb.mysqlDb() + # pymysql + db = mw.getMyORM() + # MySQLdb | + # db = mw.getMyORMDb() - conn.setHost(host[0]) - conn.setUser(conf['USER']) - conn.setPwd(conf['PASSWD']) - conn.setPort(int(host[1])) - conn.setDb(conf['NAME']) - return conn + db.setPort(int(host[1])) + db.setUser(conf['USER']) + db.setPwd(conf['PASSWD']) + db.setDbName(conf['NAME']) + # db.setSocket(getSocketFile()) + db.setCharset("utf8") + return db def pSqliteDb(conf): @@ -476,7 +476,7 @@ def userList(): start = (page - 1) * page_size list_count = pQuery('select count(id) as num from user') - count = list_count[0][0] + count = list_count[0]["num"] list_data = pQuery( 'select id,name,email from user order by id desc limit ' + str(start) + ',' + str(page_size)) data['list'] = mw.getPage({'count': count, 'p': page, diff --git a/plugins/gogs/install.sh b/plugins/gogs/install.sh index acaf61078c..73c8eeb8de 100755 --- a/plugins/gogs/install.sh +++ b/plugins/gogs/install.sh @@ -29,6 +29,8 @@ getBit(){ Install_gogs() { + pip3 install mysqlclient + mkdir -p $serverPath/source/gogs echo '正在安装脚本文件...' > $install_tmp diff --git a/plugins/gogs/js/gogs.js b/plugins/gogs/js/gogs.js index e6318cc8c7..abf8d8f328 100755 --- a/plugins/gogs/js/gogs.js +++ b/plugins/gogs/js/gogs.js @@ -163,11 +163,11 @@ function gogsUserList(page, search) { ulist = rdata['data']['data']; for (i in ulist){ - email = ulist[i][2] == '' ? '无' : ulist[i][2]; - content += ''+ulist[i][0]+''+ - ''+ulist[i][1]+''+ + email = ulist[i]["email"] == '' ? '无' : ulist[i]["email"]; + content += ''+ulist[i]["id"]+''+ + ''+ulist[i]["name"]+''+ ''+email+''+ - '项目管理'+ + '项目管理'+ ''; } diff --git a/plugins/mariadb/index.py b/plugins/mariadb/index.py index 7041e90c7d..4d3e9a8c17 100755 --- a/plugins/mariadb/index.py +++ b/plugins/mariadb/index.py @@ -2180,8 +2180,11 @@ def installPreInspection(version): def uninstallPreInspection(version): - # return "请手动删除MySQL[{}]".format(version) - return 'ok' + stop(version) + if mw.isDebugMode(): + return 'ok' + + return "请手动删除MariaDB[{}]
rm -rf {}".format(version, getServerDir()) if __name__ == "__main__": func = sys.argv[1] diff --git a/plugins/mysql/index.py b/plugins/mysql/index.py index 9fcf7b9058..d6fd083ed7 100755 --- a/plugins/mysql/index.py +++ b/plugins/mysql/index.py @@ -2338,8 +2338,11 @@ def installPreInspection(version): def uninstallPreInspection(version): - # return "请手动删除MySQL[{}]".format(version) - return 'ok' + stop(version) + if mw.isDebugMode(): + return 'ok' + + return "请手动删除MySQL[{}]
rm -rf {}".format(version, getServerDir()) if __name__ == "__main__": func = sys.argv[1] diff --git a/plugins/openresty/install.sh b/plugins/openresty/install.sh index 8c7673ba68..2bb1709367 100755 --- a/plugins/openresty/install.sh +++ b/plugins/openresty/install.sh @@ -59,10 +59,12 @@ Install_openresty() # --with-openssl=$serverPath/source/lib/openssl-1.0.2q cd ${openrestyDir}/openresty-${VERSION} && ./configure \ --prefix=$serverPath/openresty \ + --with-ipv6 \ --with-http_v2_module \ --with-http_ssl_module \ --with-http_slice_module \ - --with-http_stub_status_module + --with-http_stub_status_module \ + --with-http_realip_module make -j${cpuCore} && make install && make clean diff --git a/plugins/php-apt/index.py b/plugins/php-apt/index.py index ca94ca8778..af7397d5e2 100755 --- a/plugins/php-apt/index.py +++ b/plugins/php-apt/index.py @@ -417,8 +417,8 @@ def setFpmConfig(version): max_spare_servers = args['max_spare_servers'] pm = args['pm'] - file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf' - conf = mw.readFile(file) + filefpm = getFpmConfFile(version) + conf = mw.readFile(filefpm) rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*" conf = re.sub(rep, "\npm.max_children = " + max_children, conf) @@ -437,7 +437,7 @@ def setFpmConfig(version): rep = "\s*pm\s*=\s*(\w+)\s*" conf = re.sub(rep, "\npm = " + pm + "\n", conf) - mw.writeFile(file, conf) + mw.writeFile(filefpm, conf) reload(version) msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}', diff --git a/plugins/php-apt/versions/phplib.conf b/plugins/php-apt/versions/phplib.conf index d6a18db6c3..518ef4d843 100755 --- a/plugins/php-apt/versions/phplib.conf +++ b/plugins/php-apt/versions/phplib.conf @@ -2,6 +2,11 @@ { "name": "pdo", "versions": [ + "56", + "70", + "71", + "72", + "73", "74", "80", "81", @@ -16,6 +21,11 @@ "name": "mysqlnd", "versions": [ "56", + "70", + "71", + "72", + "73", + "74", "80", "81", "82" @@ -29,6 +39,11 @@ "name": "sqlite3", "versions": [ "56", + "70", + "71", + "72", + "73", + "74", "80", "81", "82" @@ -50,6 +65,11 @@ "name": "odbc", "versions": [ "56", + "70", + "71", + "72", + "73", + "74", "80", "81", "82" diff --git a/plugins/php-yum/index.py b/plugins/php-yum/index.py index 103f0ca533..e99c258678 100755 --- a/plugins/php-yum/index.py +++ b/plugins/php-yum/index.py @@ -412,15 +412,15 @@ def setFpmConfig(version): # if not 'max' in args: # return 'missing time args!' - version = args['version'] max_children = args['max_children'] start_servers = args['start_servers'] min_spare_servers = args['min_spare_servers'] max_spare_servers = args['max_spare_servers'] pm = args['pm'] - file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf' - conf = mw.readFile(file) + # file = getServerDir() + '/php' + version + '/php-fpm.d/www.conf' + filefpm = getFpmConfFile(version) + conf = mw.readFile(filefpm) rep = "\s*pm.max_children\s*=\s*([0-9]+)\s*" conf = re.sub(rep, "\npm.max_children = " + max_children, conf) @@ -439,7 +439,7 @@ def setFpmConfig(version): rep = "\s*pm\s*=\s*(\w+)\s*" conf = re.sub(rep, "\npm = " + pm + "\n", conf) - mw.writeFile(file, conf) + mw.writeFile(filefpm, conf) reload(version) msg = mw.getInfo('设置PHP-{1}并发设置,max_children={2},start_servers={3},min_spare_servers={4},max_spare_servers={5}', (version, max_children, diff --git a/plugins/php-yum/versions/phplib.conf b/plugins/php-yum/versions/phplib.conf index 7160c4899c..ce1b02b322 100755 --- a/plugins/php-yum/versions/phplib.conf +++ b/plugins/php-yum/versions/phplib.conf @@ -140,6 +140,26 @@ "shell": "fileinfo.sh", "check": "fileinfo" }, + { + "name": "simplexml", + "versions": [ + "53", + "54", + "55", + "56", + "70", + "71", + "72", + "73", + "74", + "80", + "81" + ], + "type": "通用扩展", + "msg": "用于XML!", + "shell": "simplexml.sh", + "check": "simplexml" + }, { "name": "exif", "versions": [ diff --git a/plugins/php/versions/common/igbinary.sh b/plugins/php/versions/common/igbinary.sh new file mode 100755 index 0000000000..cccf394273 --- /dev/null +++ b/plugins/php/versions/common/igbinary.sh @@ -0,0 +1,109 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +curPath=`pwd` +rootPath=$(dirname "$curPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +rootPath=$(dirname "$rootPath") +serverPath=$(dirname "$rootPath") +sourcePath=${serverPath}/source/php + + +actionType=$1 +version=$2 + +LIBNAME=igbinary +LIBV=3.2.7 + +if [ "$version" -lt "70" ];then + echo "not need" + exit 1 +fi + +LIB_PATH_NAME=lib/php +if [ -d $serverPath/php/${version}/lib64 ];then + LIB_PATH_NAME=lib64 +fi + +NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts` +extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so + +sysName=`uname` +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + +Install_lib() +{ + + isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` + if [ "${isInstall}" != "" ];then + echo "php-$version 已安装${LIBNAME},请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + + php_lib=$sourcePath/php_lib + mkdir -p $php_lib + if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then + wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + cd $php_lib + tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV} + + $serverPath/php/$version/bin/phpize + ./configure --with-php-config=$serverPath/php/$version/bin/php-config + make clean && make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return; + fi + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + + bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + if [ ! -f "$serverPath/php/$version/bin/php-config" ];then + echo "php-$version 未安装,请选择其它版本!" + return + fi + + if [ ! -f "$extFile" ];then + echo "php-$version 未安装${LIBNAME},请选择其它版本!" + return + fi + + echo $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}.use_namespace/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + bash ${rootPath}/plugins/php/versions/lib.sh $version restart + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/common/memcached.sh b/plugins/php/versions/common/memcached.sh index 3944cc39e7..9d647d0c00 100755 --- a/plugins/php/versions/common/memcached.sh +++ b/plugins/php/versions/common/memcached.sh @@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath") sourcePath=${serverPath}/source/php LIBNAME=memcached -LIBV=3.2.0 +LIBV=3.1.5 sysName=`uname` actionType=$1 version=$2 diff --git a/plugins/php/versions/common/xhprof.sh b/plugins/php/versions/common/xhprof.sh index 0446c86e82..78fb73195e 100755 --- a/plugins/php/versions/common/xhprof.sh +++ b/plugins/php/versions/common/xhprof.sh @@ -12,7 +12,7 @@ serverPath=$(dirname "$rootPath") sourcePath=${serverPath}/source/php LIBNAME=xhprof -LIBV=2.3.5 +LIBV=2.3.7 sysName=`uname` actionType=$1 version=$2 diff --git a/plugins/php/versions/phplib.conf b/plugins/php/versions/phplib.conf index eed637e118..7651635859 100755 --- a/plugins/php/versions/phplib.conf +++ b/plugins/php/versions/phplib.conf @@ -202,6 +202,23 @@ "shell": "exif.sh", "check": "exif.so" }, + { + "name": "igbinary", + "versions": [ + "70", + "71", + "72", + "73", + "74", + "80", + "81", + "82" + ], + "type": "通用扩展", + "msg": "序列化扩展!", + "shell": "igbinary.sh", + "check": "igbinary.so" + }, { "name": "gd", "versions": [ diff --git a/plugins/rsyncd/install.sh b/plugins/rsyncd/install.sh index cd46f09020..4b64e15ffd 100755 --- a/plugins/rsyncd/install.sh +++ b/plugins/rsyncd/install.sh @@ -23,7 +23,7 @@ Install_rsyncd() echo '正在安装脚本文件...' > $install_tmp - if [ "$OSNAME" == "debian'" ] || [ "$OSNAME" == "ubuntu'" ];then + if [ "$OSNAME" == "debian" ] || [ "$OSNAME" == "ubuntu" ];then apt install -y rsync apt install -y lsyncd elif [[ "$OSNAME" == "arch" ]]; then diff --git a/rewrite/nginx/cloudfare_real_ip.conf b/rewrite/nginx/cloudfare_real_ip.conf new file mode 100644 index 0000000000..ff540c4227 --- /dev/null +++ b/rewrite/nginx/cloudfare_real_ip.conf @@ -0,0 +1,43 @@ +location / { + + # https://www.cloudflare.com/zh-cn/ips/ + set_real_ip_from 103.21.244.0/22; + set_real_ip_from 103.22.200.0/22; + set_real_ip_from 103.31.4.0/22; + set_real_ip_from 104.16.0.0/13; + set_real_ip_from 104.24.0.0/14; + set_real_ip_from 108.162.192.0/18; + set_real_ip_from 131.0.72.0/22; + set_real_ip_from 141.101.64.0/18; + set_real_ip_from 162.158.0.0/15; + set_real_ip_from 172.64.0.0/13; + set_real_ip_from 173.245.48.0/20; + set_real_ip_from 188.114.96.0/20; + set_real_ip_from 190.93.240.0/20; + set_real_ip_from 197.234.240.0/22; + set_real_ip_from 198.41.128.0/17; + set_real_ip_from 2400:cb00::/32; + set_real_ip_from 2606:4700::/32; + set_real_ip_from 2803:f800::/32; + set_real_ip_from 2405:b500::/32; + set_real_ip_from 2405:8100::/32; + set_real_ip_from 2c0f:f248::/32; + set_real_ip_from 2a06:98c0::/29; + # use any of the following two + real_ip_header CF-Connecting-IP; + #real_ip_header X-Forwarded-For; + + + index index.html index.php; + if (-f $request_filename/index.html){ + rewrite (.*) $1/index.html break; + } + if (-f $request_filename/index.php){ + rewrite (.*) $1/index.php; + } + if (!-f $request_filename){ + rewrite (.*) /index.php; + } +} + +rewrite /wp-admin$ $scheme://$host$uri/ permanent; \ No newline at end of file diff --git a/rewrite/nginx/ecshop.conf b/rewrite/nginx/ecshop.conf index efc43792ca..109c04b6ca 100755 --- a/rewrite/nginx/ecshop.conf +++ b/rewrite/nginx/ecshop.conf @@ -1,34 +1,33 @@ location / { - if (!-e $request_filename) - { - rewrite "^/index\.html" /index.php last; - rewrite "^/category$" /index.php last; - rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last; - rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last; - rewrite "^/feed\.xml$" /feed.php last; - rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last; - rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last; - rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last; - rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last; - rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last; - rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last; - rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last; - rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last; - rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last; - rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last; - rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last; - rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last; - rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last; - rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last; - rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last; - rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last; - rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last; - rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last; - rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last; - rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last; + if (!-e $request_filename) { + rewrite "^/index\.html" /index.php last; + rewrite "^/category$" /index.php last; + rewrite "^/feed-c([0-9]+)\.xml$" /feed.php?cat=$1 last; + rewrite "^/feed-b([0-9]+)\.xml$" /feed.php?brand=$1 last; + rewrite "^/feed\.xml$" /feed.php last; + rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*)\.html$" /category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 last; + rewrite "^/category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2&page=$3 last; + rewrite "^/category-([0-9]+)-b([0-9]+)(.*)\.html$" /category.php?id=$1&brand=$2 last; + rewrite "^/category-([0-9]+)(.*)\.html$" /category.php?id=$1 last; + rewrite "^/goods-([0-9]+)(.*)\.html" /goods.php?id=$1 last; + rewrite "^/article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /article_cat.php?id=$1&page=$2&sort=$3&order=$4 last; + rewrite "^/article_cat-([0-9]+)-([0-9]+)(.*)\.html$" /article_cat.php?id=$1&page=$2 last; + rewrite "^/article_cat-([0-9]+)(.*)\.html$" /article_cat.php?id=$1 last; + rewrite "^/article-([0-9]+)(.*)\.html$" /article.php?id=$1 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html" /brand.php?id=$1&cat=$2&page=$3&sort=$4&order=$5 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2&page=$3 last; + rewrite "^/brand-([0-9]+)-c([0-9]+)(.*)\.html" /brand.php?id=$1&cat=$2 last; + rewrite "^/brand-([0-9]+)(.*)\.html" /brand.php?id=$1 last; + rewrite "^/tag-(.*)\.html" /search.php?keywords=$1 last; + rewrite "^/snatch-([0-9]+)\.html$" /snatch.php?id=$1 last; + rewrite "^/group_buy-([0-9]+)\.html$" /group_buy.php?act=view&id=$1 last; + rewrite "^/auction-([0-9]+)\.html$" /auction.php?act=view&id=$1 last; + rewrite "^/exchange-id([0-9]+)(.*)\.html$" /exchange.php?id=$1&act=view last; + rewrite "^/exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 last; + rewrite ^/exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 last; + rewrite "^/exchange-([0-9]+)-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1&page=$2 last; + rewrite "^/exchange-([0-9]+)(.*)\.html$" /exchange.php?cat_id=$1 last; } } \ No newline at end of file diff --git a/rewrite/nginx/mvc.conf b/rewrite/nginx/mvc.conf index 38cffe7740..44d945a14b 100755 --- a/rewrite/nginx/mvc.conf +++ b/rewrite/nginx/mvc.conf @@ -1,4 +1,4 @@ -location /{ +location / { if (!-e $request_filename) { rewrite ^(.*)$ /index.php/$1 last; break; diff --git a/rewrite/nginx/typecho.conf b/rewrite/nginx/typecho.conf index 43d25ea6f7..dcc7c3f1ab 100755 --- a/rewrite/nginx/typecho.conf +++ b/rewrite/nginx/typecho.conf @@ -3,3 +3,11 @@ location / { rewrite ^(.*)$ /index.php$1 last; } } + +# 不需要,可以删除 +location /typecho/ { + if (!-e $request_filename) { + rewrite ^(.*)$ /typecho/index.php$1 last; + } +} + diff --git a/rewrite/nginx/typecho2.conf b/rewrite/nginx/typecho2.conf deleted file mode 100755 index 22397d847d..0000000000 --- a/rewrite/nginx/typecho2.conf +++ /dev/null @@ -1,5 +0,0 @@ -location /typecho/ { - if (!-e $request_filename) { - rewrite ^(.*)$ /typecho/index.php$1 last; - } -} diff --git a/rewrite/nginx/whmcs.conf b/rewrite/nginx/whmcs.conf new file mode 100755 index 0000000000..2cdd0e7106 --- /dev/null +++ b/rewrite/nginx/whmcs.conf @@ -0,0 +1,16 @@ +location / { + + if (!-e $request_filename) { + rewrite ^/contact/$ /./contact.php last; + rewrite ^/status$ /./pages.php?cate=$1&page=status last; + rewrite ^/act$ /./pages.php?cate=$1&page=actindex last; + rewrite ^/(\w+)/(\w+)/$ /./pages.php?cate=$1&page=$2 last; + rewrite ^/cart/(\w+)$ /./cart.php?a=$1 last; + rewrite ^/console$ /./clientarea.php last; + rewrite ^/sitemap.xml$ /./sitemap.php last; + rewrite ^/console/(\w+)$ /./clientarea.php?action=services&group=$1 last; + rewrite ^/console/ec/([0-9]+)$ /./clientarea.php?action=productdetails&id=$1 last; + rewrite ^/console/ec/(\w+)$ /./clientarea.php?action=services&group=ec&page=$1 last; + rewrite ^ /index.php last; + } +} diff --git a/rewrite/nginx/wp2.conf b/rewrite/nginx/wp2.conf deleted file mode 100755 index 6a55902eef..0000000000 --- a/rewrite/nginx/wp2.conf +++ /dev/null @@ -1,9 +0,0 @@ - -location / { - rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last; - if (!-e $request_filename){ - rewrite ^.+?(/wp-.*) $1 last; - rewrite ^.+?(/.*\.php)$ $1 last; - rewrite ^ /index.php last; - } -} \ No newline at end of file diff --git a/route/static/favicon.ico b/route/static/favicon.ico index d3cf0fe167..7af6660603 100644 Binary files a/route/static/favicon.ico and b/route/static/favicon.ico differ diff --git a/route/static/logo.png b/route/static/logo.png new file mode 100644 index 0000000000..5bd35acc38 Binary files /dev/null and b/route/static/logo.png differ diff --git a/scripts/install.sh b/scripts/install.sh index e5d11d4396..3962e1e2fa 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -38,6 +38,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then OSNAME='alma' yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' apt update -y diff --git a/scripts/install/amazon.sh b/scripts/install/amazon.sh new file mode 100755 index 0000000000..bcadf789e8 --- /dev/null +++ b/scripts/install/amazon.sh @@ -0,0 +1,166 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +LANG=en_US.UTF-8 + +if [ ! -f /usr/bin/applydeltarpm ];then + yum -y provides '*/applydeltarpm' + yum -y install deltarpm +fi + +VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` + +setenforce 0 +sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config + +yum install -y wget lsof crontabs +yum install -y python3-devel +yum install -y python3-pip +yum install -y python-devel +yum install -y curl-devel libmcrypt libmcrypt-devel +yum install -y mysql-devel +yum install -y expect + + + +#https need +if [ ! -d /root/.acme.sh ];then + curl https://get.acme.sh | sh +fi + +if [ -f /etc/init.d/iptables ];then + + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT + iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT + # iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT + service iptables save + + iptables_status=`service iptables status | grep 'not running'` + if [ "${iptables_status}" == '' ];then + service iptables restart + fi + + #安装时不开启 + service iptables stop +fi + + +if [ ! -f /etc/init.d/iptables ];then + yum install firewalld -y + systemctl enable firewalld + #取消服务锁定 + systemctl unmask firewalld + systemctl start firewalld + + firewall-cmd --permanent --zone=public --add-port=22/tcp + firewall-cmd --permanent --zone=public --add-port=80/tcp + firewall-cmd --permanent --zone=public --add-port=443/tcp + firewall-cmd --permanent --zone=public --add-port=888/tcp + firewall-cmd --permanent --zone=public --add-port=7200/tcp + # firewall-cmd --permanent --zone=public --add-port=3306/tcp + # firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp + + + sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf + firewall-cmd --reload + #安装时不开启 + systemctl stop firewalld +fi + +yum groupinstall -y "Development Tools" +yum install -y epel-release + +yum install -y oniguruma oniguruma-devel +#centos8 stream | use dnf +if [ "$?" != "0" ];then + yum install -y dnf dnf-plugins-core + dnf config-manager --set-enabled powertools + yum install -y oniguruma oniguruma-devel + dnf upgrade -y libmodulemd +fi + + +yum install -y libtirpc libtirpc-devel +yum install -y rpcgen +yum install -y openldap openldap-devel +yum install -y bison re2c +yum install -y cmake3 +yum install -y autoconf +yum install -y make cmake gcc gcc-c++ + +yum install -y libmemcached libmemcached-devel +yum install -y curl curl-devel +yum install -y zlib zlib-devel +yum install -y libzip libzip-devel +yum install -y pcre pcre-devel +yum install -y icu libicu-devel +yum install -y freetype freetype-devel +yum install -y openssl openssl-devel +yum install -y graphviz libxml2 libxml2-devel +yum install -y sqlite-devel +yum install -y oniguruma oniguruma-devel +yum install -y ImageMagick ImageMagick-devel + + +yum install -y libzstd-devel +yum install -y libevent libevent-devel unzip zip +yum install -y python-imaging libicu-devel bzip2-devel pcre pcre-devel + +yum install -y gd gd-devel +yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel + +yum install -y net-tools +yum install -y ncurses-devel + + +for yumPack in flex file libtool libtool-libs kernel-devel patch wget glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper expat-devel readline-devel; +do yum -y install $yumPack;done + + +if [ "$VERSION_ID" -eq "8" ];then + dnf upgrade -y libmodulemd +fi + +if [ "$VERSION_ID" -eq "9" ];then + yum install -y patchelf + dnf --enablerepo=crb install -y libtirpc-devel + dnf --enablerepo=crb install -y libmemcached libmemcached-devel + dnf --enablerepo=crb install -y libtool libtool-libs + dnf --enablerepo=crb install -y gnutls-devel + dnf --enablerepo=crb install -y mysql-devel + + dnf --enablerepo=crb install -y libvpx-devel libXpm-devel libwebp libwebp-devel + dnf --enablerepo=crb install -y oniguruma oniguruma-devel + dnf --enablerepo=crb install -y libzip libzip-devel + # yum remove -y chardet +fi + + +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data + + +cd /www/server/mdserver-web && ./cli.sh start +isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` +n=0 +while [[ ! -f /etc/init.d/mw ]]; +do + echo -e ".\c" + sleep 1 + let n+=1 + if [ $n -gt 20 ];then + echo -e "start mw fail" + exit 1 + fi +done + +cd /www/server/mdserver-web && /etc/init.d/mw stop +cd /www/server/mdserver-web && /etc/init.d/mw start +cd /www/server/mdserver-web && /etc/init.d/mw default + + + diff --git a/scripts/install/centos.sh b/scripts/install/centos.sh index 3cf6bf04c4..7fad4e0c2a 100755 --- a/scripts/install/centos.sh +++ b/scripts/install/centos.sh @@ -116,7 +116,6 @@ yum install -y libjpeg-devel libpng-devel libwebp libwebp-devel yum install -y net-tools yum install -y ncurses-devel -yum install -y vixie-cron for yumPack in flex file libtool libtool-libs kernel-devel patch wget glib2 glib2-devel tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel libcurl libcurl-devel e2fsprogs e2fsprogs-devel libidn libidn-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel libcap diffutils ca-certificates net-tools psmisc libXpm-devel git-core c-ares-devel libicu-devel libxslt libxslt-devel zip unzip glibc.i686 libstdc++.so.6 cairo-devel ncurses-devel libaio-devel perl perl-devel perl-Data-Dumper expat-devel readline-devel; diff --git a/scripts/install_dev.sh b/scripts/install_dev.sh index 66ea885cd0..4f1a8f4986 100755 --- a/scripts/install_dev.sh +++ b/scripts/install_dev.sh @@ -19,7 +19,6 @@ if [ "$EUID" -ne 0 ] fi - if [ ${_os} == "Darwin" ]; then OSNAME='macos' elif grep -Eq "openSUSE" /etc/*-release; then @@ -27,10 +26,6 @@ elif grep -Eq "openSUSE" /etc/*-release; then zypper refresh elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' - pkg install -y wget unzip -elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then - OSNAME='arch' - echo y | pacman -Sy unzip elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip @@ -43,6 +38,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then OSNAME='alma' yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' apt update -y diff --git a/scripts/update.sh b/scripts/update.sh index 9e6439da2e..cd10fd0953 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -34,6 +34,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then OSNAME='alma' yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' apt install -y wget zip unzip diff --git a/scripts/update/amazon.sh b/scripts/update/amazon.sh new file mode 100755 index 0000000000..ea3c46697d --- /dev/null +++ b/scripts/update/amazon.sh @@ -0,0 +1,60 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH +LANG=en_US.UTF-8 + + +if [ -f /etc/motd ];then + echo "welcome to mdserver-web panel" > /etc/motd +fi + +sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config + +yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel + + +cd /www/server/mdserver-web/scripts && bash lib.sh +chmod 755 /www/server/mdserver-web/data + + +if [ -f /etc/init.d/mw ]; then + sh /etc/init.d/mw stop && rm -rf /www/server/mdserver-web/scripts/init.d/mw && rm -rf /etc/init.d/mw +fi + +echo -e "stop mw" +isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` + +port=7200 +if [ -f /www/server/mdserver-web/data/port.pl ]; then + port=$(cat /www/server/mdserver-web/data/port.pl) +fi + +n=0 +while [[ "$isStart" != "" ]]; +do + echo -e ".\c" + sleep 0.5 + isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs) + let n+=1 + if [ $n -gt 15 ];then + break; + fi +done + + +echo -e "start mw" +cd /www/server/mdserver-web && sh cli.sh start +isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'` +n=0 +while [[ ! -f /etc/init.d/mw ]]; +do + echo -e ".\c" + sleep 0.5 + let n+=1 + if [ $n -gt 15 ];then + break; + fi +done +echo -e "start mw success" + +bash /etc/init.d/mw default \ No newline at end of file diff --git a/scripts/update_dev.sh b/scripts/update_dev.sh index fd9d14b94b..82219145f4 100755 --- a/scripts/update_dev.sh +++ b/scripts/update_dev.sh @@ -22,8 +22,6 @@ elif grep -Eq "openSUSE" /etc/*-release; then zypper refresh elif grep -Eq "FreeBSD" /etc/*-release; then OSNAME='freebsd' -elif grep -Eqi "Arch" /etc/issue || grep -Eq "Arch" /etc/*-release; then - OSNAME='arch' elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then OSNAME='centos' yum install -y wget zip unzip @@ -36,6 +34,9 @@ elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then OSNAME='alma' yum install -y wget zip unzip +elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then + OSNAME='amazon' + yum install -y wget zip unzip elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then OSNAME='debian' apt install -y wget zip unzip @@ -48,7 +49,14 @@ else OSNAME='unknow' fi -wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip +cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"") +if [ ! -z "$cn" ];then + wget -O /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip +else + wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip +fi + +# wget -O /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip cd /tmp && unzip /tmp/dev.zip cp -rf /tmp/mdserver-web-dev/* /www/server/mdserver-web rm -rf /tmp/dev.zip