Browse Source

Update MySQL and thinkphp rewrite

lj2007331@gmail.com 7 years ago
parent
commit
8f339a62ac

+ 9 - 7
backup_setup.sh

@@ -172,19 +172,21 @@ if [[ "$DESC_BK" =~ ^[3,5,6]$ ]]; then
   while :; do echo
     echo 'Please select your backup datacenter:'
     echo -e "\t ${CMSG}1${CEND}. 华南(广州)  ${CMSG}2${CEND}. 华北(天津)"
-    echo -e "\t ${CMSG}3${CEND}. 华东(上海)  ${CMSG}4${CEND}. 新加坡"
+    echo -e "\t ${CMSG}3${CEND}. 华东(上海)  ${CMSG}4${CEND}. 西南(成都)"
+    echo -e "\t ${CMSG}5${CEND}. 新加坡"
     read -p "Please input a number:(Default 1 press Enter) " Location
     [ -z "$Location" ] && Location=1
-    if [ ${Location} -ge 1 >/dev/null 2>&1 -a ${Location} -le 4 >/dev/null 2>&1 ]; then
+    if [ ${Location} -ge 1 >/dev/null 2>&1 -a ${Location} -le 5 >/dev/null 2>&1 ]; then
       break
     else
-      echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}"
+      echo "${CWARNING}input error! Please only input number 1~5${CEND}"
     fi
   done
-  [ "$Location" == '1' ] && region=gz
-  [ "$Location" == '2' ] && region=tj
-  [ "$Location" == '3' ] && region=sh
-  [ "$Location" == '4' ] && region=sgp
+  [ "$Location" == '1' ] && region='gz'
+  [ "$Location" == '2' ] && region='tj'
+  [ "$Location" == '3' ] && region='sh'
+  [ "$Location" == '4' ] && region='cd'
+  [ "$Location" == '5' ] && region='sgp'
   while :; do echo
     read -p "Please enter the Qcloud COS appid: " appid 
     [ -z "$appid" ] && continue

+ 3 - 3
include/check_download.sh

@@ -127,7 +127,7 @@ checkDownload() {
         fi
         if [ "${dbInstallMethods}" == '1' ]; then
           echo "Download MySQL 5.7 binary package..."
-          FILE_NAME=mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
+          FILE_NAME=mysql-${mysql57_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
         elif [ "${dbInstallMethods}" == '2' ]; then
           echo "Download MySQL 5.7 source package..."
           FILE_NAME=mysql-${mysql57_version}.tar.gz
@@ -176,7 +176,7 @@ checkDownload() {
         fi
         if [ "${dbInstallMethods}" == '1' ]; then
           echo "Download MySQL 5.6 binary package..."
-          FILE_NAME=mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
+          FILE_NAME=mysql-${mysql56_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
         elif [ "${dbInstallMethods}" == '2' ]; then
           echo "Download MySQL 5.6 source package..."
           FILE_NAME=mysql-${mysql56_version}.tar.gz
@@ -224,7 +224,7 @@ checkDownload() {
         fi
         if [ "${dbInstallMethods}" == '1' ]; then
           echo "Download MySQL 5.5 binary package..."
-          FILE_NAME=mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
+          FILE_NAME=mysql-${mysql55_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
         elif [ "${dbInstallMethods}" == '2' ]; then
           echo "Download MySQL 5.5 source package..."
           FILE_NAME=mysql-${mysql55_version}.tar.gz

+ 2 - 2
include/mysql-5.5.sh

@@ -18,8 +18,8 @@ Install_MySQL55() {
   mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
 
   if [ "${dbInstallMethods}" == "1" ]; then
-    tar xvf mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
-    mv mysql-${mysql55_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir}
+    tar xvf mysql-${mysql55_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+    mv mysql-${mysql55_version}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
     sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
   elif [ "${dbInstallMethods}" == "2" ]; then

+ 2 - 2
include/mysql-5.6.sh

@@ -18,8 +18,8 @@ Install_MySQL56() {
   mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
 
   if [ "${dbInstallMethods}" == "1" ]; then
-    tar xvf mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
-    mv mysql-${mysql56_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir}
+    tar xvf mysql-${mysql56_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+    mv mysql-${mysql56_version}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
     sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
   elif [ "${dbInstallMethods}" == "2" ]; then

+ 2 - 2
include/mysql-5.7.sh

@@ -18,8 +18,8 @@ Install_MySQL57() {
   mkdir -p ${mysql_data_dir};chown mysql.mysql -R ${mysql_data_dir}
 
   if [ "${dbInstallMethods}" == "1" ]; then
-    tar xvf mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}.tar.gz
-    mv mysql-${mysql57_version}-linux-glibc2.5-${SYS_BIT_b}/* ${mysql_install_dir}
+    tar xvf mysql-${mysql57_version}-linux-glibc2.12-${SYS_BIT_b}.tar.gz
+    mv mysql-${mysql57_version}-linux-glibc2.12-${SYS_BIT_b}/* ${mysql_install_dir}
     sed -i 's@executing mysqld_safe@executing mysqld_safe\nexport LD_PRELOAD=/usr/local/lib/libjemalloc.so@' ${mysql_install_dir}/bin/mysqld_safe
     sed -i "s@/usr/local/mysql@${mysql_install_dir}@g" ${mysql_install_dir}/bin/mysqld_safe
   elif [ "${dbInstallMethods}" == "2" ]; then

+ 4 - 3
include/upgrade_db.sh

@@ -21,7 +21,7 @@ Upgrade_DB() {
     DB=Percona
     OLD_DB_version=$OLD_DB_version_tmp
   else
-    [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=https://mirrors.tuna.tsinghua.edu.cn/mysql/downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads
+    [ "$IPADDR_COUNTRY"x == "CN"x ] && DOWN_ADDR=http://mirrors.ustc.edu.cn/mysql-ftp/Downloads || DOWN_ADDR=http://cdn.mysql.com/Downloads
     DB=MySQL
     OLD_DB_version=$OLD_DB_version_tmp
   fi
@@ -63,6 +63,7 @@ Upgrade_DB() {
         DB_name=percona-server-$NEW_DB_version
         DB_URL=http://www.percona.com/redir/downloads/Percona-Server-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/LATEST/source/tarball/$DB_name.tar.gz
       elif [ "$DB" == 'MySQL' ]; then
+        DB_name=mysql-${NEW_DB_version}-linux-glibc2.12-${SYS_BIT_b}
         DB_URL=$DOWN_ADDR/MySQL-`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`/$DB_name.tar.gz
       fi
         [ ! -e "$DB_name.tar.gz" ] && wget --no-check-certificate -c $DB_URL > /dev/null 2>&1
@@ -99,7 +100,7 @@ Upgrade_DB() {
       $mariadb_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}"
     elif [ "$DB" == 'Percona' ]; then
-      tar zxf $DB_name.tar.gz
+      tar xzf $DB_name.tar.gz
       pushd $DB_name
       make clean
       if [ "`echo $NEW_DB_version | awk -F. '{print $1"."$2}'`" == '5.5' ]; then
@@ -155,7 +156,7 @@ Upgrade_DB() {
       $percona_install_dir/bin/mysql -uroot -p${dbrootpwd} -e "reset master;" >/dev/null 2>&1
       [ $? -eq 0 ] &&  echo "You have ${CMSG}successfully${CEND} upgrade from ${CMSG}$OLD_DB_version${CEND} to ${CMSG}$NEW_DB_version${CEND}"
     elif [ "$DB" == 'MySQL' ]; then
-      tar zxf $DB_name.tar.gz
+      tar xzf $DB_name.tar.gz
       service mysqld stop
       mv ${mysql_install_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}
       mv ${mysql_data_dir}{,_old_`date +"%Y%m%d_%H%M%S"`}

+ 4 - 0
tools/cos/qcloud_cos/cos_config.py

@@ -24,6 +24,10 @@ class CosRegionInfo(object):
             self._hostname = 'sgp.file.myqcloud.com'
             self._download_hostname = 'cosspg.myqcloud.com'
 
+        elif region in ['cd', 'chengdu']:
+            self._hostname = 'cd.file.myqcloud.com'
+            self._download_hostname = 'coscd.myqcloud.com'
+
         elif region is not None:
             self._hostname = '{region}.file.myqcloud.com'.format(region=region)
             self._download_hostname = 'cos{region}.myqcloud.com'.format(region=region)

+ 6 - 5
tools/cos/qcloud_cos/cos_op.py

@@ -103,7 +103,7 @@ class BaseOp(object):
                 http_resp = self._http_session.get(url, verify=False, **kwargs)
 
             status_code = http_resp.status_code
-            if status_code == 200 or status_code == 400:
+            if status_code < 500:
                 return http_resp.json()
             else:
                 logger.warning("request failed, response message: %s" % http_resp.text)
@@ -371,7 +371,8 @@ class FileOp(BaseOp):
 
         local_path = request.get_local_path()
         file_size = os.path.getsize(local_path)
-        slice_size = control_ret[u'data'][u'slice_size']
+        if u'slice_size' in control_ret[u'data']:
+            slice_size = control_ret[u'data'][u'slice_size']
         offset = 0
         session = control_ret[u'data'][u'session']
         # ?concurrency
@@ -531,10 +532,10 @@ class FileOp(BaseOp):
         else:
             return ret
 
-    def __download_url(self, uri, filename):
+    def __download_url(self, uri, filename, headers):
         session = self._http_session
 
-        with closing(session.get(uri, stream=True, timeout=150)) as ret:
+        with closing(session.get(uri, stream=True, timeout=30, headers=headers)) as ret:
             if ret.status_code in [200, 206]:
 
                 if 'Content-Length' in ret.headers:
@@ -562,7 +563,7 @@ class FileOp(BaseOp):
         url = self.build_download_url(request.get_bucket_name(), request.get_cos_path(), sign)
         logger.info("Uri is %s" % url)
         try:
-            self.__download_url(url, request._local_filename)
+            self.__download_url(url, request._local_filename, request._custom_headers)
             return {u'code': 0, u'message': "download successfully"}
         except Exception as e:
             return {u'code': 1, u'message': "download failed, exception: " + str(e)}

+ 4 - 0
tools/cos/qcloud_cos/cos_request.py

@@ -595,6 +595,10 @@ class DownloadFileRequest(BaseRequest):
         self._range_start = range_start
         self._range_end = range_end
 
+        self._custom_headers = None
+        if 'headers' in kwargs:
+            self._custom_headers = kwargs['headers']
+
     def check_params_valid(self):
         if not super(DownloadFileRequest, self).check_params_valid():
             return False

+ 95 - 0
tools/cos/qcloud_cos/threadpool.py

@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+
+from threading import Thread
+from logging import getLogger
+from Queue import Queue
+from threading import Lock
+
+logger = getLogger(__name__)
+
+
+class WorkerThread(Thread):
+    def __init__(self, task_queue, *args, **kwargs):
+        super(WorkerThread, self).__init__(*args, **kwargs)
+
+        self._task_queue = task_queue
+        self._succ_task_num = 0
+        self._fail_task_num = 0
+        self._ret = list()
+
+    def run(self):
+
+        while True:
+            func, args, kwargs = self._task_queue.get()
+
+            try:
+                ret = func(*args, **kwargs)
+                self._succ_task_num += 1
+                self._ret.append(ret)
+
+            except Exception as e:
+                logger.warn(str(e))
+                self._fail_task_num += 1
+                self._ret.append(e)
+            finally:
+                self._task_queue.task_done()
+
+    def get_result(self):
+            return self._succ_task_num, self._fail_task_num, self._ret
+
+
+class SimpleThreadPool:
+
+    def __init__(self, num_threads=5):
+        self._num_threads = num_threads
+        self._queue = Queue()
+        self._lock = Lock()
+        self._active = False
+        self._workers = list()
+        self._finished = False
+
+    def add_task(self, func, *args, **kwargs):
+        if not self._active:
+            with self._lock:
+                if not self._active:
+                    self._active = True
+
+                    for i in range(self._num_threads):
+                        w = WorkerThread(self._queue)
+                        self._workers.append(w)
+                        w.start()
+
+        self._queue.put((func, args, kwargs))
+
+    def wait_completion(self):
+        self._queue.join()
+        self._finished = True
+
+    def get_result(self):
+        assert self._finished
+        detail = [worker.get_result() for worker in self._workers]
+        succ_all = all([tp[1] == 0 for tp in detail])
+        return {'success_all': succ_all, 'detail': detail}
+
+
+if __name__ == '__main__':
+
+    pool = SimpleThreadPool(2)
+
+    def task_sleep(x):
+        from time import sleep
+        sleep(x)
+        return 'hello, sleep %d seconds' % x
+
+    def raise_exception():
+        raise ValueError("Pa! Exception!")
+
+    pool.add_task(task_sleep, 5)
+    pool.add_task(task_sleep, 2)
+    pool.add_task(task_sleep, 3)
+    pool.add_task(raise_exception)
+    pool.add_task(raise_exception)
+
+    pool.wait_completion()
+    print pool.get_result()
+    # [(1, 0, ['hello, sleep 5 seconds']), (2, 1, ['hello, sleep 2 seconds', 'hello, sleep 3 seconds', ValueError('Pa! Exception!',)])]

+ 2 - 2
tools/coscmd

@@ -57,10 +57,10 @@ def cmd_configure(args, options):
     config.set(CONFIGSECTION, 'appid', options.appid)
     config.set(CONFIGSECTION, 'secret_id', options.secret_id)
     config.set(CONFIGSECTION, 'secret_key', options.secret_key)
-    if options.region in ['sh','gz','tj','sgp']:
+    if options.region in ['sh','gz','tj','cd','sgp']:
         config.set(CONFIGSECTION, 'region', options.region)
     else:
-        print("input region error, setup use : --region={sh,gz,tj,sgp}")
+        print("input region error, setup use : --region={sh,gz,tj,cd,sgp}")
         sys.exit(-1)
     config.set(CONFIGSECTION, 'bucket', options.bucket)
     cfgfile = open(CONFIGFILE, 'w+')

+ 14 - 4
uninstall.sh

@@ -75,7 +75,6 @@ Print_web() {
   [ -e "/etc/logrotate.d/tomcat" ] && echo "/etc/logrotate.d/tomcat"
   [ -d "/usr/java" ] && echo '/usr/java'
   [ -d "/usr/local/apr" ] && echo '/usr/local/apr'
-  [ -d "${openssl_install_dir}" ] && echo "${openssl_install_dir}"
 }
 
 Uninstall_Web() {
@@ -85,7 +84,6 @@ Uninstall_Web() {
   [ -d "${apache_install_dir}" ] && { service httpd stop > /dev/null 2>&1; rm -rf ${apache_install_dir} /etc/init.d/httpd /etc/logrotate.d/apache; sed -i "s@${apache_install_dir}/bin:@@" /etc/profile; }
   [ -d "${tomcat_install_dir}" ] && { killall java > /dev/null 2>&1; chmod +x /etc/logrotate.d/tomcat; rm -rf ${tomcat_install_dir} /etc/init.d/tomcat /etc/logrotate.d/tomcat /usr/local/apr; }
   [ -d "/usr/java" ] && { rm -rf /usr/java; sed -i '/export JAVA_HOME=/d' /etc/profile; sed -i '/export CLASSPATH=/d' /etc/profile; sed -i 's@\$JAVA_HOME/bin:@@' /etc/profile; }
-  [ -d "${openssl_install_dir}" ] && rm -rf ${openssl_install_dir}
   [ -e "${wwwroot_dir}" ] && /bin/mv ${wwwroot_dir}{,$(date +%Y%m%d%H)}
   sed -i 's@^website_name=.*@website_name=@' ./options.conf
   sed -i 's@^local_bankup_yn=.*@local_bankup_yn=y@' ./options.conf
@@ -113,7 +111,6 @@ Print_PHP() {
   [ -e "/etc/init.d/php-fpm" ] && echo "/etc/init.d/php-fpm"
   [ -e "/usr/local/imagemagick" ] && echo "/usr/local/imagemagick"
   [ -e "/usr/local/graphicsmagick" ] && echo '/usr/local/graphicsmagick'
-  [ -e "/usr/local/openssl100s" ] && echo '/usr/local/openssl100s'
 }
 
 Uninstall_PHP() {
@@ -121,7 +118,6 @@ Uninstall_PHP() {
   [ -e "${php_install_dir}/bin/phpize" -a ! -e "${php_install_dir}/etc/php-fpm.conf" ] && rm -rf ${php_install_dir}
   [ -e "/usr/local/imagemagick" ] && rm -rf /usr/local/imagemagick
   [ -e "/usr/local/graphicsmagick" ] && rm -rf /usr/local/graphicsmagick
-  [ -e "/usr/local/openssl100s" ] && rm -rf /usr/local/openssl100s 
   sed -i "s@${php_install_dir}/bin:@@" /etc/profile
   echo "${CMSG}PHP uninstall completed${CEND}"
 }
@@ -174,6 +170,16 @@ Uninstall_Memcached() {
   echo "${CMSG}Memcached uninstall completed${CEND}"
 }
 
+Print_curlopenssl() {
+  [ -e "/usr/local/bin/curl" ] && echo "/usr/local/bin/curl"
+  [ -d "${openssl_install_dir}" ] && echo "${openssl_install_dir}"
+}
+
+Uninstall_curlopenssl() {
+  [ -e "/usr/local/bin/curl" ] && rm -rf /usr/local/lib/libcurl* /usr/local/bin/curl
+  [ -d "${openssl_install_dir}" ] && { rm -rf ${openssl_install_dir} /etc/ld.so.conf.d/openssl.conf; ldconfig; }
+}
+
 Menu(){
 while :; do
   printf "
@@ -203,6 +209,7 @@ What Are You Doing?
       Print_PureFtpd
       Print_Redis
       Print_Memcached
+      Print_curlopenssl
 
       Uninstall_status
       if [ "${uninstall_yn}" == 'y' ]; then
@@ -213,6 +220,7 @@ What Are You Doing?
         Uninstall_PureFtpd
         Uninstall_Redis
         Uninstall_Memcached
+        Uninstall_curlopenssl
       else
         exit
       fi
@@ -275,6 +283,7 @@ elif [ $# == 1 ]; then
     Print_PureFtpd
     Print_Redis
     Print_Memcached
+    Print_curlopenssl
 
     Uninstall_status
     if [ "${uninstall_yn}" == 'y' ]; then
@@ -285,6 +294,7 @@ elif [ $# == 1 ]; then
       Uninstall_PureFtpd
       Uninstall_Redis
       Uninstall_Memcached
+      Uninstall_curlopenssl
     else
       exit
     fi

+ 20 - 20
versions.txt

@@ -1,30 +1,30 @@
 # newest software version
 # Web
-nginx_version=1.12.0
+nginx_version=1.12.1
 tengine_version=2.1.2
-openresty_version=1.11.2.3
+openresty_version=1.11.2.4
 openssl_version=1.0.2l
 
-tomcat8_version=8.5.15
-tomcat7_version=7.0.78
+tomcat8_version=8.5.16
+tomcat7_version=7.0.79
 tomcat6_version=6.0.53
 
-apache24_version=2.4.26
-apache22_version=2.2.32
-pcre_version=8.40
+apache24_version=2.4.27
+apache22_version=2.2.34
+pcre_version=8.41
 apr_version=1.6.2
 apr_util_version=1.6.0
-nghttp2_version=1.23.1
+nghttp2_version=1.24.0
 
 # DB
-mysql57_version=5.7.18
-mysql56_version=5.6.36
-mysql55_version=5.5.56
+mysql57_version=5.7.19
+mysql56_version=5.6.37
+mysql55_version=5.5.57
 
-mariadb102_version=10.2.6
+mariadb102_version=10.2.7
 mariadb101_version=10.1.25
 mariadb100_version=10.0.31
-mariadb55_version=5.5.56
+mariadb55_version=5.5.57
 
 percona57_version=5.7.18-15
 percona56_version=5.6.36-82.0
@@ -40,7 +40,7 @@ jdk16_version=1.6.0_45
 # PHP
 php71_version=7.1.7
 php70_version=7.0.21
-php56_version=5.6.30
+php56_version=5.6.31
 php55_version=5.5.38
 php54_version=5.4.45
 php53_version=5.3.29
@@ -49,10 +49,10 @@ zendopcache_version=7.0.5
 xcache_version=3.2.0
 apcu_version=4.0.11
 apcu_for_php7_version=5.1.8
-ImageMagick_version=6.9.8-10
+ImageMagick_version=6.9.9-0
 imagick_version=3.4.3
 imagick_for_php53_version=3.3.0
-GraphicsMagick_version=1.3.25
+GraphicsMagick_version=1.3.26
 gmagick_for_php7_version=2.0.4RC1
 gmagick_version=1.1.7RC3
 libiconv_version=1.15
@@ -66,8 +66,8 @@ eaccelerator_version=0.9.6.1
 pureftpd_version=1.0.46
 
 # Redis
-redis_version=3.2.9
-redis_pecl_for_php7_version=3.1.2
+redis_version=4.0.0
+redis_pecl_for_php7_version=3.1.3
 redis_pecl_version=2.2.8
 
 # Memcached
@@ -81,7 +81,7 @@ memcache_pecl_version=3.0.8
 phpMyAdmin_version=4.4.15.10
 
 # jemalloc
-jemalloc_version=4.5.0
+jemalloc_version=5.0.1
 
 # boost
 boost_version=1.59.0
@@ -94,4 +94,4 @@ bison_version=2.7.1
 python_version=2.7.13
 setuptools_version=32.0.0
 pip_version=9.0.1
-fail2ban_version=0.9.6
+fail2ban_version=0.9.7

+ 2 - 2
vhost.sh

@@ -444,7 +444,7 @@ Nginx_rewrite() {
       rewrite="other"
     fi
     echo "You choose rewrite=${CMSG}$rewrite${CEND}"
-    [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ \.php {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi_params;\n    set \$real_script_name \$fastcgi_script_name;\n    if (\$fastcgi_script_name ~ \"^(.+?\.php)(/.+)\$\") {\n      set \$real_script_name \$1;\n      #set \$path_info \$2;\n    }\n    fastcgi_param SCRIPT_FILENAME \$document_root\$real_script_name;\n    fastcgi_param SCRIPT_NAME \$real_script_name;\n    #fastcgi_param PATH_INFO \$path_info;\n  }")
+    [ "${NGX_FLAG}" == 'php' -a "${rewrite}" == "thinkphp" ] && NGX_CONF=$(echo -e "location ~ [^/]\.php(/|$) {\n    #fastcgi_pass remote_php_ip:9000;\n    fastcgi_pass unix:/dev/shm/php-cgi.sock;\n    fastcgi_index index.php;\n    include fastcgi.conf;\n    fastcgi_split_path_info ^(.+?\.php)(/.*)\$;\n    set \$path_info \$fastcgi_path_info;\n    fastcgi_param PATH_INFO \$path_info;\n    try_files \$fastcgi_script_name =404;\n  }")
     if [ "${rewrite}" != 'magento2' ]; then
       if [ -e "config/${rewrite}.conf" ]; then
         /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/rewrite/${rewrite}.conf
@@ -973,7 +973,7 @@ Del_Apache_Vhost() {
 Del_Tomcat_Vhost() {
   if [ -e "${tomcat_install_dir}/conf/server.xml" ]; then
     if [ -e "${web_install_dir}/sbin/nginx" ]; then
-      if [ -n "$(grep vhost-${domain} ${tomcat_install_dir}/conf/server.xml)" ]; then
+      if [ -n "$(echo ${domain} | grep '.*\..*')" ] && [ -n "$(grep vhost-${domain} ${tomcat_install_dir}/conf/server.xml)" ]; then
         sed -i /vhost-${domain}/d ${tomcat_install_dir}/conf/server.xml
         rm -rf ${tomcat_install_dir}/conf/vhost/${domain}.xml
         /etc/init.d/tomcat restart