From 1d5069ae9c7cefbf205ef92b0843f516058000cc Mon Sep 17 00:00:00 2001 From: "lj2007331@gmail.com" Date: Wed, 21 Nov 2018 17:40:53 +0800 Subject: [PATCH] Apache2.4 use fcgi,change args,systemd mongod --- addons.sh | 25 ++++++++++- include/alisql-5.6.sh | 2 +- include/apache-2.2.sh | 4 +- include/apache-2.4.sh | 28 +++++++----- include/check_download.sh | 2 +- include/check_os.sh | 2 +- include/mariadb-10.0.sh | 2 +- include/mariadb-10.1.sh | 2 +- include/mariadb-10.2.sh | 2 +- include/mariadb-10.3.sh | 2 +- include/mariadb-5.5.sh | 2 +- include/memcached.sh | 4 +- include/mongodb.sh | 11 ++++- include/mysql-5.5.sh | 2 +- include/mysql-5.6.sh | 2 +- include/mysql-5.7.sh | 2 +- include/mysql-8.0.sh | 2 +- include/nginx.sh | 2 +- include/openresty.sh | 2 +- include/percona-5.5.sh | 2 +- include/percona-5.6.sh | 2 +- include/percona-5.7.sh | 2 +- include/php-5.3.sh | 43 +++++++++--------- include/php-5.4.sh | 41 +++++++++-------- include/php-5.5.sh | 43 +++++++++--------- include/php-5.6.sh | 43 +++++++++--------- include/php-7.0.sh | 41 +++++++++-------- include/php-7.1.sh | 43 +++++++++--------- include/php-7.2.sh | 36 ++++++++------- include/postgresql.sh | 2 +- include/pureftpd.sh | 4 +- include/python.sh | 2 +- include/redis.sh | 2 +- include/tengine.sh | 2 +- include/tomcat-6.sh | 4 +- include/tomcat-7.sh | 4 +- include/tomcat-8.sh | 4 +- include/tomcat-9.sh | 4 +- include/upgrade_web.sh | 6 +-- include/xcache.sh | 6 +-- init.d/mongod.service | 37 ++++++++++++++++ install.sh | 5 ++- ss.sh | 10 ++--- uninstall.sh | 23 +++++----- versions.txt | 12 ++--- vhost.sh | 92 ++++++++++++++++++++++----------------- 46 files changed, 347 insertions(+), 268 deletions(-) create mode 100644 init.d/mongod.service diff --git a/addons.sh b/addons.sh index b2ebe20b..b33e9f84 100755 --- a/addons.sh +++ b/addons.sh @@ -63,6 +63,29 @@ if [ -e "${php_install_dir}/bin/phpize" ]; then phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) PHP_detail_ver=$(${php_install_dir}/bin/php -r 'echo PHP_VERSION;') PHP_main_ver=${PHP_detail_ver%.*} + case "${PHP_main_ver}" in + 5.3) + php_option=1 + ;; + 5.4) + php_option=2 + ;; + 5.5) + php_option=3 + ;; + 5.6) + php_option=4 + ;; + 7.0) + php_option=5 + ;; + 7.1) + php_option=6 + ;; + 7.2) + php_option=7 + ;; + esac fi # Check PHP Extensions @@ -103,7 +126,7 @@ Install_fail2ban() { chkconfig --add fail2ban chkconfig fail2ban on fi - if [ "${PM}" == 'apt' ]; then + if [ "${PM}" == 'apt-get' ]; then LOGPATH=/var/log/auth.log /bin/cp files/debian-initd /etc/init.d/fail2ban sed -i 's@2 3 4 5@3 4 5@' /etc/init.d/fail2ban diff --git a/include/alisql-5.6.sh b/include/alisql-5.6.sh index cab18ba6..ff0e96f9 100644 --- a/include/alisql-5.6.sh +++ b/include/alisql-5.6.sh @@ -52,7 +52,7 @@ Install_AliSQL56() { sed -i "s@^datadir=.*@datadir=${alisql_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/apache-2.2.sh b/include/apache-2.2.sh index 584758be..973c3adf 100644 --- a/include/apache-2.2.sh +++ b/include/apache-2.2.sh @@ -16,7 +16,7 @@ Install_Apache22() { pushd httpd-${apache22_ver} [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir} [ "${Ubuntu_ver}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c - LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl--with-ssl=${openssl_install_dir} --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --enable-mpms-shared=all --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-expires --enable-static-support --enable-suexec --with-expat=builtin --enable-mods-shared=most --enable-ssl --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install unset LDFLAGS if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then @@ -37,7 +37,7 @@ Install_Apache22() { sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd chmod +x /etc/init.d/httpd [ "${PM}" == 'yum' ] && { chkconfig --add httpd; chkconfig httpd on; } - [ "${PM}" == 'apt' ] && update-rc.d httpd defaults + [ "${PM}" == 'apt-get' ] && update-rc.d httpd defaults sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf sed -i "s@^Group daemon@Group ${run_user}@" ${apache_install_dir}/conf/httpd.conf diff --git a/include/apache-2.4.sh b/include/apache-2.4.sh index 01c5c4ce..558e6250 100644 --- a/include/apache-2.4.sh +++ b/include/apache-2.4.sh @@ -11,10 +11,10 @@ Install_Apache24() { pushd ${oneinstack_dir}/src > /dev/null tar xzf pcre-${pcre_ver}.tar.gz - pushd pcre-${pcre_ver} + pushd pcre-${pcre_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf httpd-${apache24_ver}.tar.gz @@ -24,26 +24,25 @@ Install_Apache24() { # install nghttp2 if [ ! -e "/usr/local/lib/libnghttp2.so" ]; then tar xzf nghttp2-${nghttp2_ver}.tar.gz - pushd nghttp2-${nghttp2_ver} + pushd nghttp2-${nghttp2_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null [ -z "`grep /usr/local/lib /etc/ld.so.conf.d/*.conf`" ] && echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf ldconfig rm -rf nghttp2-${nghttp2_ver} fi - pushd httpd-${apache24_ver} + pushd httpd-${apache24_ver} > /dev/null [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir} /bin/cp -R ../apr-${apr_ver} ./srclib/apr /bin/cp -R ../apr-util-${apr_util_ver} ./srclib/apr-util - [[ "${php_option}" =~ ^[1-4]$ ]] && Apache_mpm_arg='--with-mpm=prefork' - LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} ${Apache_mpm_arg} --enable-mpms-shared=all --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local make -j ${THREAD} && make install + popd > /dev/null unset LDFLAGS if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then echo "${CSUCCESS}Apache installed successfully! ${CEND}" - popd rm -rf httpd-${apache24_ver} pcre-${pcre_ver} apr-${apr_ver} apr-util-${apr_util_ver} else rm -rf ${apache_install_dir} @@ -60,7 +59,7 @@ Install_Apache24() { sed -i '3a # description: Apache is a World Wide Web server. It is used to serve' /etc/init.d/httpd chmod +x /etc/init.d/httpd [ "${PM}" == 'yum' ] && { chkconfig --add httpd; chkconfig httpd on; } - [ "${PM}" == 'apt' ] && update-rc.d httpd defaults + [ "${PM}" == 'apt-get' ] && update-rc.d httpd defaults sed -i "s@^User daemon@User ${run_user}@" ${apache_install_dir}/conf/httpd.conf sed -i "s@^Group daemon@Group ${run_user}@" ${apache_install_dir}/conf/httpd.conf @@ -74,6 +73,8 @@ Install_Apache24() { fi sed -i "s@AddType\(.*\)Z@AddType\1Z\n AddType application/x-httpd-php .php .phtml\n AddType application/x-httpd-php-source .phps@" ${apache_install_dir}/conf/httpd.conf sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_proxy.so)@\1@' ${apache_install_dir}/conf/httpd.conf + sed -ri 's@^#(.*mod_proxy_fcgi.so)@\1@' ${apache_install_dir}/conf/httpd.conf sed -ri 's@^#(.*mod_suexec.so)@\1@' ${apache_install_dir}/conf/httpd.conf sed -ri 's@^#(.*mod_vhost_alias.so)@\1@' ${apache_install_dir}/conf/httpd.conf sed -ri 's@^#(.*mod_rewrite.so)@\1@' ${apache_install_dir}/conf/httpd.conf @@ -110,6 +111,13 @@ EOF ServerName 127.0.0.1 ErrorLog "${wwwlogs_dir}/error_apache.log" CustomLog "${wwwlogs_dir}/access_apache.log" common + + Order allow,deny + Deny from all + + + SetHandler "proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost" + SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI @@ -157,5 +165,5 @@ EOF fi ldconfig service httpd start - popd + popd > /dev/null } diff --git a/include/check_download.sh b/include/check_download.sh index 53c3b353..1a06b0cd 100644 --- a/include/check_download.sh +++ b/include/check_download.sh @@ -822,7 +822,7 @@ checkDownload() { if [ "${PM}" == 'yum' ]; then echo "Download tmux for CentOS..." src_url=${mirrorLink}/libevent-${libevent_ver}.tar.gz && Download_src - src_url=https://github.com/tmux/tmux/releases/download/${tmux_ver}/tmux-${tmux_ver}.tar.gz && Download_src + src_url=${mirrorLink}/tmux-${tmux_ver}.tar.gz && Download_src echo "Download htop for CentOS..." src_url=http://hisham.hm/htop/releases/${htop_ver}/htop-${htop_ver}.tar.gz && Download_src diff --git a/include/check_os.sh b/include/check_os.sh index 1aa7ad45..b406dbe1 100644 --- a/include/check_os.sh +++ b/include/check_os.sh @@ -13,7 +13,7 @@ if [ -e "/usr/bin/yum" ]; then command -v lsb_release >/dev/null 2>&1 || { yum -y install redhat-lsb-core; clear; } fi if [ -e "/usr/bin/apt-get" ]; then - PM=apt + PM=apt-get command -v lsb_release >/dev/null 2>&1 || { apt-get -y update; apt-get -y install lsb-release; clear; } fi diff --git a/include/mariadb-10.0.sh b/include/mariadb-10.0.sh index 87751aa2..58cecc4a 100644 --- a/include/mariadb-10.0.sh +++ b/include/mariadb-10.0.sh @@ -63,7 +63,7 @@ Install_MariaDB100() { sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mariadb-10.1.sh b/include/mariadb-10.1.sh index 216cc81c..53d83d58 100644 --- a/include/mariadb-10.1.sh +++ b/include/mariadb-10.1.sh @@ -67,7 +67,7 @@ Install_MariaDB101() { sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mariadb-10.2.sh b/include/mariadb-10.2.sh index c1278b3b..bdf4ea07 100644 --- a/include/mariadb-10.2.sh +++ b/include/mariadb-10.2.sh @@ -67,7 +67,7 @@ Install_MariaDB102() { sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mariadb-10.3.sh b/include/mariadb-10.3.sh index 8cfc66dc..b139584a 100644 --- a/include/mariadb-10.3.sh +++ b/include/mariadb-10.3.sh @@ -67,7 +67,7 @@ Install_MariaDB103() { sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mariadb-5.5.sh b/include/mariadb-5.5.sh index e0f11e82..5dd1de93 100644 --- a/include/mariadb-5.5.sh +++ b/include/mariadb-5.5.sh @@ -65,7 +65,7 @@ Install_MariaDB55() { sed -i "s@^datadir=.*@datadir=${mariadb_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/memcached.sh b/include/memcached.sh index 136fed7a..ea9d4017 100644 --- a/include/memcached.sh +++ b/include/memcached.sh @@ -26,7 +26,7 @@ Install_memcached() { rm -rf memcached-${memcached_ver} ln -s ${memcached_install_dir}/bin/memcached /usr/bin/memcached [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/Memcached-init-CentOS /etc/init.d/memcached; chkconfig --add memcached; chkconfig memcached on; } - [ "${PM}" == 'apt' ] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } + [ "${PM}" == 'apt-get' ] && { /bin/cp ../init.d/Memcached-init-Ubuntu /etc/init.d/memcached; update-rc.d memcached defaults; } sed -i "s@/usr/local/memcached@${memcached_install_dir}@g" /etc/init.d/memcached let memcachedCache="${Mem}/8" [ -n "$(grep 'CACHESIZE=' /etc/init.d/memcached)" ] && sed -i "s@^CACHESIZE=.*@CACHESIZE=${memcachedCache}@" /etc/init.d/memcached @@ -80,7 +80,7 @@ Install_pecl-memcached() { patch -d libmemcached-${libmemcached_ver} -p0 < libmemcached-build.patch pushd libmemcached-${libmemcached_ver} > /dev/null [ "${PM}" == 'yum' ] && yum -y install cyrus-sasl-devel - [ "${PM}" == 'apt' ] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure + [ "${PM}" == 'apt-get' ] && sed -i "s@lthread -pthread -pthreads@lthread -lpthread -pthreads@" ./configure ./configure --with-memcached=${memcached_install_dir} make -j ${THREAD} && make install popd > /dev/null diff --git a/include/mongodb.sh b/include/mongodb.sh index e24156db..df60e3e3 100644 --- a/include/mongodb.sh +++ b/include/mongodb.sh @@ -15,8 +15,15 @@ Install_MongoDB() { mkdir -p ${mongo_data_dir};chown mongod.mongod -R ${mongo_data_dir} tar xzf mongodb-linux-${SYS_BIT_b}-${mongodb_ver}.tgz /bin/mv mongodb-linux-${SYS_BIT_b}-${mongodb_ver} ${mongo_install_dir} - [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/MongoDB-init-CentOS /etc/init.d/mongod; sed -i "s@/usr/local/mongodb@${mongo_install_dir}@g" /etc/init.d/mongod; chkconfig --add mongod; chkconfig mongod on; } - [ "${PM}" == 'apt' ] && { /bin/cp ../init.d/MongoDB-init-Ubuntu /etc/init.d/mongod; sed -i "s@/usr/local/mongodb@${mongo_install_dir}@g" /etc/init.d/mongod; update-rc.d mongod defaults; } + if [ -e /bin/systemctl ]; then + /bin/cp ${oneinstack_dir}/init.d/mongod.service /lib/systemd/system/ + sed -i "s@=/usr/local/mongodb@=${mongo_install_dir}@g" /lib/systemd/system/mongod.service + systemctl enable mongod + else + [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/MongoDB-init-CentOS /etc/init.d/mongod; sed -i "s@/usr/local/mongodb@${mongo_install_dir}@g" /etc/init.d/mongod; chkconfig --add mongod; chkconfig mongod on; } + [ "${PM}" == 'apt-get' ] && { /bin/cp ../init.d/MongoDB-init-Ubuntu /etc/init.d/mongod; sed -i "s@/usr/local/mongodb@${mongo_install_dir}@g" /etc/init.d/mongod; update-rc.d mongod defaults; } + fi + cat > /etc/mongod.conf << EOF # mongod.conf diff --git a/include/mysql-5.5.sh b/include/mysql-5.5.sh index 0614443e..a1a4f6ca 100644 --- a/include/mysql-5.5.sh +++ b/include/mysql-5.5.sh @@ -65,7 +65,7 @@ Install_MySQL55() { sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mysql-5.6.sh b/include/mysql-5.6.sh index bea5ca9e..698a7bc4 100644 --- a/include/mysql-5.6.sh +++ b/include/mysql-5.6.sh @@ -63,7 +63,7 @@ Install_MySQL56() { sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mysql-5.7.sh b/include/mysql-5.7.sh index f3365e3a..17a401f2 100644 --- a/include/mysql-5.7.sh +++ b/include/mysql-5.7.sh @@ -67,7 +67,7 @@ Install_MySQL57() { sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/mysql-8.0.sh b/include/mysql-8.0.sh index 8089a85f..32858012 100644 --- a/include/mysql-8.0.sh +++ b/include/mysql-8.0.sh @@ -65,7 +65,7 @@ Install_MySQL80() { sed -i "s@^datadir=.*@datadir=${mysql_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/nginx.sh b/include/nginx.sh index a1075f79..dc18ef2c 100644 --- a/include/nginx.sh +++ b/include/nginx.sh @@ -52,7 +52,7 @@ Install_Nginx() { systemctl enable nginx else [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } - [ "${PM}" == 'apt' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; } + [ "${PM}" == 'apt-get' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${nginx_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; } fi mv ${nginx_install_dir}/conf/nginx.conf{,_bk} diff --git a/include/openresty.sh b/include/openresty.sh index c6d61b81..8154d774 100644 --- a/include/openresty.sh +++ b/include/openresty.sh @@ -49,7 +49,7 @@ Install_OpenResty() { systemctl enable nginx else [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${openresty_install_dir}/nginx@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } - [ "${PM}" == 'apt' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${openresty_install_dir}/nginx@g" /etc/init.d/nginx; update-rc.d nginx defaults; } + [ "${PM}" == 'apt-get' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${openresty_install_dir}/nginx@g" /etc/init.d/nginx; update-rc.d nginx defaults; } fi mv ${openresty_install_dir}/nginx/conf/nginx.conf{,_bk} diff --git a/include/percona-5.5.sh b/include/percona-5.5.sh index 1f99271d..c08d4670 100644 --- a/include/percona-5.5.sh +++ b/include/percona-5.5.sh @@ -66,7 +66,7 @@ Install_Percona55() { sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/percona-5.6.sh b/include/percona-5.6.sh index cae7419d..232ec9dd 100644 --- a/include/percona-5.6.sh +++ b/include/percona-5.6.sh @@ -65,7 +65,7 @@ Install_Percona56() { sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/percona-5.7.sh b/include/percona-5.7.sh index ec30822c..8110302b 100644 --- a/include/percona-5.7.sh +++ b/include/percona-5.7.sh @@ -69,7 +69,7 @@ Install_Percona57() { sed -i "s@^datadir=.*@datadir=${percona_data_dir}@" /etc/init.d/mysqld chmod +x /etc/init.d/mysqld [ "${PM}" == 'yum' ] && { chkconfig --add mysqld; chkconfig mysqld on; } - [ "${PM}" == 'apt' ] && update-rc.d mysqld defaults + [ "${PM}" == 'apt-get' ] && update-rc.d mysqld defaults popd # my.cnf diff --git a/include/php-5.3.sh b/include/php-5.3.sh index bee2c803..0800b9c2 100644 --- a/include/php-5.3.sh +++ b/include/php-5.3.sh @@ -13,41 +13,42 @@ Install_PHP53() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -66,25 +67,25 @@ Install_PHP53() { [ ! -e '/usr/include/freetype2/freetype' ] && ln -s /usr/include/freetype2 /usr/include/freetype2/freetype - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php53_ver}.tar.gz patch -d php-${php53_ver} -p0 < fpm-race-condition.patch - pushd php-${php53_ver} + pushd php-${php53_ver} > /dev/null patch -p1 < ../php5.3patch patch -p1 < ../debian_patches_disable_SSLv2_for_openssl_1_0_0.patch make clean [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \ @@ -142,12 +143,12 @@ Install_PHP53() { sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php53_ver} - popd + popd > /dev/null } diff --git a/include/php-5.4.sh b/include/php-5.4.sh index bce91399..cf8cd47a 100644 --- a/include/php-5.4.sh +++ b/include/php-5.4.sh @@ -13,7 +13,7 @@ Install_PHP54() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install popd @@ -22,32 +22,33 @@ Install_PHP54() { if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -64,23 +65,23 @@ Install_PHP54() { fi fi - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php54_ver}.tar.gz patch -d php-${php54_ver} -p0 < fpm-race-condition.patch - pushd php-${php54_ver} + pushd php-${php54_ver} > /dev/null make clean [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs --disable-fileinfo \ @@ -137,12 +138,12 @@ Install_PHP54() { sed -i 's@^disable_functions.*@disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen@' ${php_install_dir}/etc/php.ini [ -e /usr/sbin/sendmail ] && sed -i 's@^;sendmail_path.*@sendmail_path = /usr/sbin/sendmail -t -i@' ${php_install_dir}/etc/php.ini - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php54_ver} - popd + popd > /dev/null } diff --git a/include/php-5.5.sh b/include/php-5.5.sh index 01e4a91c..1c56a559 100644 --- a/include/php-5.5.sh +++ b/include/php-5.5.sh @@ -13,41 +13,42 @@ Install_PHP55() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -64,22 +65,22 @@ Install_PHP55() { fi fi - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php55_ver}.tar.gz patch -d php-${php55_ver} -p0 < fpm-race-condition.patch - pushd php-${php55_ver} + pushd php-${php55_ver} > /dev/null [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache' - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \ @@ -150,12 +151,12 @@ opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php55_ver} - popd + popd > /dev/null } diff --git a/include/php-5.6.sh b/include/php-5.6.sh index 94c41e70..fc97e61c 100644 --- a/include/php-5.6.sh +++ b/include/php-5.6.sh @@ -13,41 +13,42 @@ Install_PHP56() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -64,23 +65,23 @@ Install_PHP56() { fi fi - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php56_ver}.tar.gz - pushd php-${php56_ver} + pushd php-${php56_ver} > /dev/null make clean [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache' - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \ @@ -153,12 +154,12 @@ opcache.enable_cli=1 ;opcache.optimization_level=0 EOF - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php56_ver} - popd + popd > /dev/null } diff --git a/include/php-7.0.sh b/include/php-7.0.sh index 19c4162a..0c630645 100644 --- a/include/php-7.0.sh +++ b/include/php-7.0.sh @@ -13,41 +13,42 @@ Install_PHP70() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -64,13 +65,13 @@ Install_PHP70() { fi fi - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} @@ -81,7 +82,7 @@ Install_PHP70() { ./buildconf [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache' - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \ @@ -159,12 +160,12 @@ opcache.consistency_checks=0 ;opcache.optimization_level=0 EOF - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php70_ver} - popd + popd > /dev/null } diff --git a/include/php-7.1.sh b/include/php-7.1.sh index de868e8f..3a704a55 100644 --- a/include/php-7.1.sh +++ b/include/php-7.1.sh @@ -13,41 +13,42 @@ Install_PHP71() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/local/lib/libmcrypt.la" ]; then tar xzf libmcrypt-${libmcrypt_ver}.tar.gz - pushd libmcrypt-${libmcrypt_ver} + pushd libmcrypt-${libmcrypt_ver} > /dev/null ./configure make -j ${THREAD} && make install ldconfig - pushd libltdl + pushd libltdl > /dev/null ./configure --enable-ltdl-install make -j ${THREAD} && make install - popd;popd + popd > /dev/null + popd > /dev/null rm -rf libmcrypt-${libmcrypt_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -64,24 +65,24 @@ Install_PHP71() { fi fi - tar xzf mcrypt-$mcrypt_ver.tar.gz - pushd mcrypt-$mcrypt_ver + tar xzf mcrypt-${mcrypt_ver}.tar.gz + pushd mcrypt-${mcrypt_ver} > /dev/null ldconfig ./configure make -j ${THREAD} && make install - popd - rm -rf mcrypt-$mcrypt_ver + popd > /dev/null + rm -rf mcrypt-${mcrypt_ver} id -u ${run_user} >/dev/null 2>&1 [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php71_ver}.tar.gz - pushd php-${php71_ver} + pushd php-${php71_ver} > /dev/null make clean ./buildconf [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache' - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \ @@ -159,12 +160,12 @@ opcache.consistency_checks=0 ;opcache.optimization_level=0 EOF - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php71_ver} - popd + popd > /dev/null } diff --git a/include/php-7.2.sh b/include/php-7.2.sh index db8c1397..312a946c 100644 --- a/include/php-7.2.sh +++ b/include/php-7.2.sh @@ -13,45 +13,45 @@ Install_PHP72() { if [ ! -e "/usr/local/lib/libiconv.la" ]; then tar xzf libiconv-${libiconv_ver}.tar.gz patch -d libiconv-${libiconv_ver} -p0 < libiconv-glibc-2.16.patch - pushd libiconv-${libiconv_ver} + pushd libiconv-${libiconv_ver} > /dev/null ./configure --prefix=/usr/local make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libiconv-${libiconv_ver} fi if [ ! -e "${curl_install_dir}/lib/libcurl.la" ]; then tar xzf curl-${curl_ver}.tar.gz - pushd curl-${curl_ver} + pushd curl-${curl_ver} > /dev/null ./configure -Wl,-rpath=${curl_install_dir}/lib --prefix=${curl_install_dir} --with-ssl=${openssl_install_dir} make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf curl-${curl_ver} fi if [ ! -e "/usr/lib/libargon2.a" ]; then tar xzf argon2-${argon2_ver}.tar.gz - pushd argon2-${argon2_ver} + pushd argon2-${argon2_ver} > /dev/null make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf argon2-${argon2_ver} fi if [ ! -e "/usr/local/lib/libsodium.la" ]; then tar xzf libsodium-${libsodium_ver}.tar.gz - pushd libsodium-${libsodium_ver} + pushd libsodium-${libsodium_ver} > /dev/null ./configure --disable-dependency-tracking --enable-minimal make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf libsodium-${libsodium_ver} fi if [ ! -e "/usr/local/lib/libmhash.la" ]; then tar xzf mhash-${mhash_ver}.tar.gz - pushd mhash-${mhash_ver} + pushd mhash-${mhash_ver} > /dev/null ./configure make -j ${THREAD} && make install - popd + popd > /dev/null rm -rf mhash-${mhash_ver} fi @@ -71,12 +71,12 @@ Install_PHP72() { [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user} tar xzf php-${php72_ver}.tar.gz - pushd php-${php72_ver} + pushd php-${php72_ver} > /dev/null make clean ./buildconf [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} [ "${phpcache_option}" == '1' ] && phpcache_arg='--enable-opcache' || phpcache_arg='--disable-opcache' - if [[ ${apache_option} =~ ^[1-2]$ ]] || [ -e "${apache_install_dir}/bin/apxs" ]; then + if [ "${apache_option}" == '2' ] || [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '2' ]; then ./configure --prefix=${php_install_dir} --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-apxs2=${apache_install_dir}/bin/apxs ${phpcache_arg} --disable-fileinfo \ @@ -153,12 +153,12 @@ opcache.consistency_checks=0 ;opcache.optimization_level=0 EOF - if [[ ! ${apache_option} =~ ^[1-2]$ ]] && [ ! -e "${apache_install_dir}/bin/apxs" ]; then + if [ ! -e "${apache_install_dir}/bin/apxs" -o "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then # php-fpm Init Script /bin/cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm chmod +x /etc/init.d/php-fpm [ "${PM}" == 'yum' ] && { chkconfig --add php-fpm; chkconfig php-fpm on; } - [ "${PM}" == 'apt' ] && update-rc.d php-fpm defaults + [ "${PM}" == 'apt-get' ] && update-rc.d php-fpm defaults cat > ${php_install_dir}/etc/php-fpm.conf < /dev/null [ -e "${php_install_dir}/bin/phpize" ] && rm -rf php-${php72_ver} - popd + popd > /dev/null } diff --git a/include/postgresql.sh b/include/postgresql.sh index b1bf6147..de1b1616 100644 --- a/include/postgresql.sh +++ b/include/postgresql.sh @@ -31,7 +31,7 @@ Install_PostgreSQL() { sed -i "s@^PGDATA=.*@PGDATA=${pgsql_data_dir}@" /etc/init.d/postgresql chmod +x /etc/init.d/postgresql [ "${PM}" == 'yum' ] && { chkconfig --add postgresql; chkconfig postgresql on; } - [ "${PM}" == 'apt' ] && update-rc.d postgresql defaults + [ "${PM}" == 'apt-get' ] && update-rc.d postgresql defaults fi popd su - postgres -c "${pgsql_install_dir}/bin/initdb -D ${pgsql_data_dir}" diff --git a/include/pureftpd.sh b/include/pureftpd.sh index b4d68e2a..fc232a73 100644 --- a/include/pureftpd.sh +++ b/include/pureftpd.sh @@ -29,7 +29,7 @@ Install_PureFTPd() { sed -i "s@/usr/local/pureftpd@${pureftpd_install_dir}@g" /etc/init.d/pureftpd chmod +x /etc/init.d/pureftpd [ "${PM}" == 'yum' ] && { chkconfig --add pureftpd; chkconfig pureftpd on; } - [ "${PM}" == 'apt' ] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } + [ "${PM}" == 'apt-get' ] && { sed -i 's@^. /etc/rc.d/init.d/functions@. /lib/lsb/init-functions@' /etc/init.d/pureftpd; update-rc.d pureftpd defaults; } [ "${Debian_ver}" == '7' ] && sed -i 's@/var/lock/subsys/@/var/lock/@g' /etc/init.d/pureftpd fi @@ -56,7 +56,7 @@ Install_PureFTPd() { iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -z "$(grep '20000:30000' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT iptables -I INPUT 6 -p tcp -m state --state NEW -m tcp --dport 20000:30000 -j ACCEPT diff --git a/include/python.sh b/include/python.sh index b25ac6c8..b1b1a0fe 100644 --- a/include/python.sh +++ b/include/python.sh @@ -37,7 +37,7 @@ EOF for Package in ${pkgList}; do yum -y install ${Package} done - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then pkgList="gcc dialog libaugeas0 augeas-lenses libssl-dev libffi-dev ca-certificates" for Package in ${pkgList}; do apt-get -y install $Package diff --git a/include/redis.sh b/include/redis.sh index a140d0c8..e55ffe05 100644 --- a/include/redis.sh +++ b/include/redis.sh @@ -44,7 +44,7 @@ Install_redis-server() { /bin/cp ../init.d/Redis-server-init /etc/init.d/redis-server sed -i "s@/usr/local/redis@${redis_install_dir}@g" /etc/init.d/redis-server [ "${PM}" == 'yum' ] && { cc start-stop-daemon.c -o /sbin/start-stop-daemon; chkconfig --add redis-server; chkconfig redis-server on; } - [ "${PM}" == 'apt' ] && update-rc.d redis-server defaults + [ "${PM}" == 'apt-get' ] && update-rc.d redis-server defaults fi #[ -z "`grep 'vm.overcommit_memory' /etc/sysctl.conf`" ] && echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf #sysctl -p diff --git a/include/tengine.sh b/include/tengine.sh index b1a33785..21ddbd0f 100644 --- a/include/tengine.sh +++ b/include/tengine.sh @@ -50,7 +50,7 @@ Install_Tengine() { systemctl enable nginx else [ "${PM}" == 'yum' ] && { /bin/cp ../init.d/Nginx-init-CentOS /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /etc/init.d/nginx; chkconfig --add nginx; chkconfig nginx on; } - [ "${PM}" == 'apt' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; } + [ "${PM}" == 'apt-get' ] && { /bin/cp ../init.d/Nginx-init-Ubuntu /etc/init.d/nginx; sed -i "s@/usr/local/nginx@${tengine_install_dir}@g" /etc/init.d/nginx; update-rc.d nginx defaults; } fi mv ${tengine_install_dir}/conf/nginx.conf{,_bk} diff --git a/include/tomcat-6.sh b/include/tomcat-6.sh index 79cad1f0..07a845c1 100644 --- a/include/tomcat-6.sh +++ b/include/tomcat-6.sh @@ -77,7 +77,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -125,7 +125,7 @@ EOF sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=${tomcat_install_dir}@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=${run_user}@" /etc/init.d/tomcat [ "${PM}" == 'yum' ] && { chkconfig --add tomcat; chkconfig tomcat on; } - [ "${PM}" == 'apt' ] && update-rc.d tomcat defaults + [ "${PM}" == 'apt-get' ] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" rm -rf apache-tomcat-${tomcat6_ver} else diff --git a/include/tomcat-7.sh b/include/tomcat-7.sh index 21cc4f92..9bd264aa 100644 --- a/include/tomcat-7.sh +++ b/include/tomcat-7.sh @@ -77,7 +77,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -125,7 +125,7 @@ EOF sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=${tomcat_install_dir}@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=${run_user}@" /etc/init.d/tomcat [ "${PM}" == 'yum' ] && { chkconfig --add tomcat; chkconfig tomcat on; } - [ "${PM}" == 'apt' ] && update-rc.d tomcat defaults + [ "${PM}" == 'apt-get' ] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" rm -rf apache-tomcat-${tomcat7_ver} else diff --git a/include/tomcat-8.sh b/include/tomcat-8.sh index 5e31ae79..f1deaead 100644 --- a/include/tomcat-8.sh +++ b/include/tomcat-8.sh @@ -77,7 +77,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -125,7 +125,7 @@ EOF sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=${tomcat_install_dir}@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=${run_user}@" /etc/init.d/tomcat [ "${PM}" == 'yum' ] && { chkconfig --add tomcat; chkconfig tomcat on; } - [ "${PM}" == 'apt' ] && update-rc.d tomcat defaults + [ "${PM}" == 'apt-get' ] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" rm -rf apache-tomcat-${tomcat8_ver} else diff --git a/include/tomcat-9.sh b/include/tomcat-9.sh index a5627f8b..65bc5630 100644 --- a/include/tomcat-9.sh +++ b/include/tomcat-9.sh @@ -77,7 +77,7 @@ EOF iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -z "$(grep -w '8080' /etc/iptables.up.rules)" ]; then iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT iptables-save > /etc/iptables.up.rules @@ -125,7 +125,7 @@ EOF sed -i "s@^CATALINA_HOME=.*@CATALINA_HOME=${tomcat_install_dir}@" /etc/init.d/tomcat sed -i "s@^TOMCAT_USER=.*@TOMCAT_USER=${run_user}@" /etc/init.d/tomcat [ "${PM}" == 'yum' ] && { chkconfig --add tomcat; chkconfig tomcat on; } - [ "${PM}" == 'apt' ] && update-rc.d tomcat defaults + [ "${PM}" == 'apt-get' ] && update-rc.d tomcat defaults echo "${CSUCCESS}Tomcat installed successfully! ${CEND}" rm -rf apache-tomcat-${tomcat9_ver} else diff --git a/include/upgrade_web.sh b/include/upgrade_web.sh index 5d952dd2..bbe29e33 100644 --- a/include/upgrade_web.sh +++ b/include/upgrade_web.sh @@ -241,12 +241,10 @@ Upgrade_Apache() { if [ "${Apache_flag}" == '24' ]; then /bin/cp -R ../apr-${apr_ver} ./srclib/apr /bin/cp -R ../apr-util-${apr_util_ver} ./srclib/apr-util - [ -e "${php_install_dir}/bin/phpize" ] && { PHP_detail_ver=`${php_install_dir}/bin/php -r 'echo PHP_VERSION;'`; PHP_master_ver=${PHP_detail_ver%%.*}; } - [ "${PHP_master_ver}" == '5' ] && Apache_mpm_arg='--with-mpm=prefork' - LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} ${Apache_mpm_arg} --enable-mpms-shared=all --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --enable-mpms-shared=all --with-pcre --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-remoteip --enable-expires --enable-static-support --enable-suexec --enable-mods-shared=most --enable-nonportable-atomics=yes --enable-ssl --with-ssl=${openssl_install_dir} --enable-http2 --with-nghttp2=/usr/local elif [ "${Apache_flag}" == '22' ]; then [ "${Ubuntu_ver}" == "12" ] && sed -i '@SSL_PROTOCOL_SSLV2@d' modules/ssl/ssl_engine_io.c - LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-rewrite --enable-ssl--with-ssl=${openssl_install_dir} --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all + LDFLAGS=-ldl ./configure --prefix=${apache_install_dir} --with-mpm=prefork --enable-mpms-shared=all --with-included-apr --enable-headers --enable-mime-magic --enable-deflate --enable-proxy --enable-so --enable-dav --enable-rewrite --enable-expires --enable-static-support --enable-suexec --with-expat=builtin --enable-mods-shared=most --enable-ssl --with-ssl=${openssl_install_dir} fi make -j ${THREAD} if [ -e 'httpd' ]; then diff --git a/include/xcache.sh b/include/xcache.sh index 97e12abf..56cbc408 100644 --- a/include/xcache.sh +++ b/include/xcache.sh @@ -12,13 +12,13 @@ Install_XCache() { pushd ${oneinstack_dir}/src > /dev/null phpExtensionDir=$(${php_install_dir}/bin/php-config --extension-dir) tar xzf xcache-${xcache_ver}.tar.gz - pushd xcache-${xcache_ver} + pushd xcache-${xcache_ver} > /dev/null ${php_install_dir}/bin/phpize ./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=${php_install_dir}/bin/php-config make -j ${THREAD} && make install if [ -f "${phpExtensionDir}/xcache.so" ]; then /bin/cp -R htdocs ${wwwroot_dir}/default/xcache - popd + popd > /dev/null chown -R ${run_user}.${run_user} ${wwwroot_dir}/default/xcache touch /tmp/xcache;chown ${run_user}.${run_user} /tmp/xcache let xcacheCount="${CPU}+1" @@ -65,5 +65,5 @@ EOF else echo "${CFAILURE}Xcache module install failed, Please contact the author! ${CEND}" fi - popd + popd > /dev/null } diff --git a/init.d/mongod.service b/init.d/mongod.service new file mode 100644 index 00000000..258dc9de --- /dev/null +++ b/init.d/mongod.service @@ -0,0 +1,37 @@ +[Unit] +Description=MongoDB Database Server +After=multi-user.target +Documentation=https://docs.mongodb.org/manual + +[Service] +User=mongod +Group=mongod +Environment="OPTIONS=-f /etc/mongod.conf" +EnvironmentFile=-/etc/sysconfig/mongod +ExecStart=/usr/local/mongodb/bin/mongod $OPTIONS +ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb +ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb +ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb +PermissionsStartOnly=true +PIDFile=/var/run/mongodb/mongod.pid +Type=forking +# file size +LimitFSIZE=infinity +# cpu time +LimitCPU=infinity +# virtual memory size +LimitAS=infinity +# open files +LimitNOFILE=64000 +# processes/threads +LimitNPROC=64000 +# locked memory +LimitMEMLOCK=infinity +# total threads (user+kernel) +TasksMax=infinity +TasksAccounting=false +# Recommended limits for for mongod as specified in +# http://docs.mongodb.org/manual/reference/ulimit/#recommended-settings + +[Install] +WantedBy=multi-user.target diff --git a/install.sh b/install.sh index 0f8ffb65..7d61bbc2 100755 --- a/install.sh +++ b/install.sh @@ -658,6 +658,9 @@ if [ ${ARG_NUM} == 0 ]; then done fi +# install wget gcc curl python +${PM} -y -q install wget gcc curl python + # get the IP information IPADDR=$(./include/get_ipaddr.py) PUBLIC_IPADDR=$(./include/get_public_ipaddr.py) @@ -666,8 +669,6 @@ IPADDR_COUNTRY=$(./include/get_ipaddr_state.py $PUBLIC_IPADDR) # Check download source packages . ./include/check_download.sh downloadDepsSrc=1 -[ "${PM}" == 'yum' ] && yum -y -q install wget gcc -[ "${PM}" == 'apt' ] && apt-get -y -q install wget gcc checkDownload 2>&1 | tee -a ${oneinstack_dir}/install.log # del openssl for jcloud diff --git a/ss.sh b/ss.sh index 076f54ce..8eccdb6a 100755 --- a/ss.sh +++ b/ss.sh @@ -76,7 +76,7 @@ Iptables_set() { iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${SS_port} -j ACCEPT service iptables save fi - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then if [ -n "`grep 'dport 80 ' /etc/iptables.up.rules`" -a -z "$(grep -E ${SS_port} /etc/iptables.up.rules)" ]; then iptables -I INPUT 4 -p udp -m state --state NEW -m udp --dport ${SS_port} -j ACCEPT iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport ${SS_port} -j ACCEPT @@ -106,7 +106,7 @@ Def_parameter() { for Package in ${pkgList}; do yum -y install ${Package} done - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then apt-get -y update pkgList="curl wget unzip gcc swig automake make perl cpio git libudns-dev libev-dev gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libc-ares-dev" for Package in ${pkgList}; do @@ -126,7 +126,7 @@ Install_SS-python() { chmod +x /etc/init.d/shadowsocks sed -i "s@SS_bin=.*@SS_bin=${python_install_dir}/bin/ssserver@" /etc/init.d/shadowsocks [ "${PM}" == 'yum' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; } - [ "${PM}" == 'apt' ] && update-rc.d shadowsocks defaults + [ "${PM}" == 'apt-get' ] && update-rc.d shadowsocks defaults else echo echo "${CQUESTION}SS-python install failed! Please visit https://oneinstack.com${CEND}" @@ -164,7 +164,7 @@ Install_SS-libev() { /bin/cp ../init.d/SS-libev-init-CentOS /etc/init.d/shadowsocks chkconfig --add shadowsocks chkconfig shadowsocks on - elif [ "${PM}" == 'apt' ]; then + elif [ "${PM}" == 'apt-get' ]; then /bin/cp ../init.d/SS-libev-init-Ubuntu /etc/init.d/shadowsocks update-rc.d shadowsocks defaults fi @@ -188,7 +188,7 @@ Uninstall_SS() { if [ "${SS_yn}" == 'y' ]; then [ -n "$(ps -ef | grep -v grep | grep -iE "ssserver|ss-server")" ] && /etc/init.d/shadowsocks stop [ "${PM}" == 'yum' ] && chkconfig --del shadowsocks - [ "${PM}" == 'apt' ] && update-rc.d -f shadowsocks remove + [ "${PM}" == 'apt-get' ] && update-rc.d -f shadowsocks remove rm -rf /etc/shadowsocks /var/run/shadowsocks.pid /etc/init.d/shadowsocks if [ "${ss_option}" == '1' ]; then rm -f /usr/local/bin/{ss-local,ss-tunnel,ss-server,ss-manager,ss-redir} diff --git a/uninstall.sh b/uninstall.sh index 3a1e5fce..2079cca8 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -103,11 +103,13 @@ Print_MySQL() { Print_PostgreSQL() { [ -e "${pgsql_install_dir}" ] && echo "${pgsql_install_dir}" [ -e "/etc/init.d/postgresql" ] && echo "/etc/init.d/postgresql" + [ -e "/lib/systemd/system/postgresql.service" ] && echo "/lib/systemd/system/postgresql.service" } Print_MongoDB() { [ -e "${mongo_install_dir}" ] && echo "${mongo_install_dir}" [ -e "/etc/init.d/mongod" ] && echo "/etc/init.d/mongod" + [ -e "/lib/systemd/system/mongod.service" ] && echo "/lib/systemd/system/mongod.service" [ -e "/etc/mongod.conf" ] && echo "/etc/mongod.conf" } @@ -129,7 +131,8 @@ Uninstall_PostgreSQL() { if [ -e "${pgsql_install_dir}/bin/psql" ]; then service postgresql stop > /dev/null 2>&1 rm -rf ${pgsql_install_dir} /etc/init.d/postgresql - [ -e "${php_install_dir}/etc/php.d/07-pgsql.ini" ] && rm -rf ${php_install_dir}/etc/php.d/07-pgsql.ini + [ -e "/lib/systemd/system/postgresql.service" ] && { systemctl disable postgresql > /dev/null 2>&1; rm -f /lib/systemd/system/postgresql.service; } + [ -e "${php_install_dir}/etc/php.d/07-pgsql.ini" ] && rm -f ${php_install_dir}/etc/php.d/07-pgsql.ini id -u postgres >/dev/null 2>&1 ; [ $? -eq 0 ] && userdel postgres [ -e "${pgsql_data_dir}" ] && /bin/mv ${pgsql_data_dir}{,$(date +%Y%m%d%H)} sed -i 's@^dbpostgrespwd=.*@dbpostgrespwd=@' ./options.conf @@ -143,8 +146,9 @@ Uninstall_MongoDB() { if [ -e "${mongo_install_dir}/bin/mongo" ]; then service mongod stop > /dev/null 2>&1 rm -rf ${mongo_install_dir} /etc/mongod.conf /etc/init.d/mongod /tmp/mongo*.sock - [ -e "${php_install_dir}/etc/php.d/07-mongo.ini" ] && rm -rf ${php_install_dir}/etc/php.d/07-mongo.ini - [ -e "${php_install_dir}/etc/php.d/07-mongodb.ini" ] && rm -rf ${php_install_dir}/etc/php.d/07-mongodb.ini + [ -e "/lib/systemd/system/mongod.service" ] && { systemctl disable mongod > /dev/null 2>&1; rm -f /lib/systemd/system/mongod.service; } + [ -e "${php_install_dir}/etc/php.d/07-mongo.ini" ] && rm -f ${php_install_dir}/etc/php.d/07-mongo.ini + [ -e "${php_install_dir}/etc/php.d/07-mongodb.ini" ] && rm -f ${php_install_dir}/etc/php.d/07-mongodb.ini id -u mongod > /dev/null 2>&1 ; [ $? -eq 0 ] && userdel mongod [ -e "${mongo_data_dir}" ] && /bin/mv ${mongo_data_dir}{,$(date +%Y%m%d%H)} sed -i 's@^dbmongopwd=.*@dbmongopwd=@' ./options.conf @@ -180,30 +184,31 @@ Print_HHVM() { } Uninstall_HHVM() { - [ -e "/lib/systemd/system/hhvm.service" ] && { systemctl disable hhvm > /dev/null 2>&1; rm -rf /lib/systemd/system/hhvm.service; } - [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -rf /etc/supervisord.conf /etc/init.d/supervisord; } + [ -e "/lib/systemd/system/hhvm.service" ] && { systemctl disable hhvm > /dev/null 2>&1; rm -f /lib/systemd/system/hhvm.service; } + [ -e "/etc/init.d/supervisord" ] && { service supervisord stop > /dev/null 2>&1; rm -f /etc/supervisord.conf /etc/init.d/supervisord; } [ -e "/usr/bin/hhvm" ] && { rpm -e hhvm; rm -rf /etc/hhvm /var/log/hhvm /usr/bin/hhvm; echo "${CMSG}HHVM uninstall completed! ${CEND}"; } } Print_PureFtpd() { [ -e "${pureftpd_install_dir}" ] && echo "${pureftpd_install_dir}" [ -e "/etc/init.d/pureftpd" ] && echo "/etc/init.d/pureftpd" + [ -e "/lib/systemd/system/pureftpd.service" ] && echo "/lib/systemd/system/pureftpd.service" } Uninstall_PureFtpd() { [ -e "${pureftpd_install_dir}" ] && { service pureftpd stop > /dev/null 2>&1; rm -rf ${pureftpd_install_dir} /etc/init.d/pureftpd; echo "${CMSG}Pureftpd uninstall completed! ${CEND}"; } + [ -e "/lib/systemd/system/pureftpd.service" ] && { systemctl disable pureftpd > /dev/null 2>&1; rm -f /lib/systemd/system/pureftpd.service; } } Print_Redis() { - [ -e "$redis_install_dir" ] && echo "$redis_install_dir" + [ -e "${redis_install_dir}" ] && echo "${redis_install_dir}" [ -e "/etc/init.d/redis-server" ] && echo "/etc/init.d/redis-server" [ -e "/lib/systemd/system/redis-server.service" ] && echo '/lib/systemd/system/redis-server.service' } Uninstall_Redis() { - [ -e "$redis_install_dir" ] && { service redis-server stop > /dev/null 2>&1; rm -rf $redis_install_dir /etc/init.d/redis-server /usr/local/bin/redis-*; echo "${CMSG}Redis uninstall completed! ${CEND}"; } + [ -e "${redis_install_dir}" ] && { service redis-server stop > /dev/null 2>&1; rm -rf ${redis_install_dir} /etc/init.d/redis-server /usr/local/bin/redis-*; echo "${CMSG}Redis uninstall completed! ${CEND}"; } [ -e "/lib/systemd/system/redis-server.service" ] && { systemctl disable redis-server > /dev/null 2>&1; rm -f /lib/systemd/system/redis-server.service; } - [ -e "${php_install_dir}/etc/php.d/05-redis.ini" ] && { rm -rf ${php_install_dir}/etc/php.d/05-redis.ini; echo "${CMSG}Pecl_redis uninstall completed! ${CEND}"; } } Print_Memcached() { @@ -214,8 +219,6 @@ Print_Memcached() { Uninstall_Memcached() { [ -e "${memcached_install_dir}" ] && { service memcached stop > /dev/null 2>&1; rm -rf ${memcached_install_dir} /etc/init.d/memcached /usr/bin/memcached; echo "${CMSG}Memcached uninstall completed! ${CEND}"; } - [ -e "${php_install_dir}/etc/php.d/05-memcache.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcache.ini - [ -e "${php_install_dir}/etc/php.d/05-memcached.ini" ] && rm -rf ${php_install_dir}/etc/php.d/05-memcached.ini } Print_openssl() { diff --git a/versions.txt b/versions.txt index 43e218db..773a0a0d 100644 --- a/versions.txt +++ b/versions.txt @@ -3,12 +3,12 @@ nginx_ver=1.14.1 tengine_ver=2.2.3 openresty_ver=1.13.6.2 -openssl11_ver=1.1.1 -openssl_ver=1.0.2p +openssl11_ver=1.1.1a +openssl_ver=1.0.2q tomcat9_ver=9.0.13 tomcat8_ver=8.5.35 -tomcat7_ver=7.0.91 +tomcat7_ver=7.0.92 tomcat6_ver=6.0.53 apache24_ver=2.4.37 @@ -56,7 +56,7 @@ php54_ver=5.4.45 php53_ver=5.3.29 libiconv_ver=1.15 -curl_ver=7.61.1 +curl_ver=7.62.0 libmcrypt_ver=2.5.8 mcrypt_ver=2.6.8 mhash_ver=0.9.9.9 @@ -81,7 +81,7 @@ pureftpd_ver=1.0.47 # Redis redis_ver=5.0.1 -pecl_redis_ver=4.1.1 +pecl_redis_ver=4.2.0 # Memcached memcached_ver=1.5.12 @@ -107,7 +107,7 @@ boost_oldver=1.59.0 # Others libevent_ver=2.0.22-stable -tmux_ver=2.7 +tmux_ver=2.8 htop_ver=2.2.0 bison_ver=2.7.1 python_ver=3.6.7 diff --git a/vhost.sh b/vhost.sh index be874872..e9e71538 100755 --- a/vhost.sh +++ b/vhost.sh @@ -186,7 +186,7 @@ If you enter '.', the field will be left blank. echo "Syntax: export Key1=Value1 ; export Key2=Value1" read -e -p "Please enter your dnsapi parameters: " DNS_PAR echo - eval $DNS_PAR + eval ${DNS_PAR} if [ $? == 0 ]; then break else @@ -234,7 +234,7 @@ EOF ~/.acme.sh/acme.sh --issue -d ${domain} ${moredomainame_D} -w ${vhostdir} fi if [ -s ~/.acme.sh/${domain}/fullchain.cer ]; then - [ -e "${PATH_SSL}/${domain}.crt" ] && rm -rf ${PATH_SSL}/${domain}.{crt,key} + [ -e "${PATH_SSL}/${domain}.crt" ] && rm -f ${PATH_SSL}/${domain}.{crt,key} [ -e /bin/systemctl -a -e /lib/systemd/system/nginx.service ] && Nginx_cmd='/bin/systemctl restart nginx' || Nginx_cmd='/etc/init.d/nginx force-reload' if [ -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/conf/httpd.conf" ]; then Command="${Nginx_cmd};/etc/init.d/httpd graceful" @@ -295,11 +295,11 @@ What Are You Doing? if [ -e "${web_install_dir}/sbin/nginx" ]; then nginx_ssl_flag=y PATH_SSL=${web_install_dir}/conf/ssl - [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL}; + [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL} elif [ ! -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/bin/apachectl" ]; then apache_ssl_flag=y PATH_SSL=${apache_install_dir}/conf/ssl - [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL}; + [ ! -d "${PATH_SSL}" ] && mkdir ${PATH_SSL} fi elif [ "${Domian_Mode}" == 'q' ]; then exit 1 @@ -431,8 +431,6 @@ Nginx_anti_hotlinking() { fi domain_allow_all=`echo ${domain_allow_all} | tr ' ' '\n' | awk '!a[$1]++' | xargs` anti_hotlinking=$(echo -e "location ~ .*\.(wma|wmv|asf|mp3|mmf|zip|rar|jpg|gif|png|swf|flv|mp4)$ {\n valid_referers none blocked ${domain_allow_all};\n if (\$invalid_referer) {\n return 403;\n }\n }") - else - anti_hotlinking= fi } @@ -472,20 +470,20 @@ Nginx_rewrite() { } Nginx_log() { -while :; do echo + while :; do echo read -e -p "Allow Nginx/Tengine/OpenResty access_log? [y/n]: " access_flag if [[ ! "${access_flag}" =~ ^[y,n]$ ]]; then - echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" + echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}" else - break + break fi -done -if [ "${access_flag}" == 'n' ]; then - N_log="access_log off;" -else - N_log="access_log ${wwwlogs_dir}/${domain}_nginx.log combined;" + done + if [ "${access_flag}" == 'n' ]; then + Nginx_log="access_log off;" + else + Nginx_log="access_log ${wwwlogs_dir}/${domain}_nginx.log combined;" echo "You access log file=${CMSG}${wwwlogs_dir}/${domain}_nginx.log${CEND}" -fi + fi } Create_nginx_tomcat_conf() { @@ -494,7 +492,7 @@ Create_nginx_tomcat_conf() { server { ${Nginx_conf} server_name ${domain}${moredomainame}; - ${N_log} + ${Nginx_log} index index.html index.htm index.jsp; root ${vhostdir}; ${Nginx_redirect} @@ -537,7 +535,7 @@ EOF ${web_install_dir}/sbin/nginx -s reload /etc/init.d/tomcat restart else - rm -rf ${web_install_dir}/conf/vhost/${domain}.conf + rm -f ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -587,7 +585,7 @@ Create_nginx_php-fpm_hhvm_conf() { server { ${Nginx_conf} server_name ${domain}${moredomainame}; - ${N_log} + ${Nginx_log} index index.html index.htm index.php; root ${vhostdir}; ${Nginx_redirect} @@ -616,7 +614,7 @@ EOF /bin/cp config/${rewrite}.conf ${web_install_dir}/conf/vhost/${domain}.conf sed -i "s@^ set \$MAGE_ROOT.*;@ set \$MAGE_ROOT ${vhostdir};@" ${web_install_dir}/conf/vhost/${domain}.conf sed -i "s@^ server_name.*;@ server_name ${domain}${moredomainame};@" ${web_install_dir}/conf/vhost/${domain}.conf - sed -i "s@^ server_name.*;@&\n ${N_log}@" ${web_install_dir}/conf/vhost/${domain}.conf + sed -i "s@^ server_name.*;@&\n ${Nginx_log}@" ${web_install_dir}/conf/vhost/${domain}.conf [ "${NGX_FLAG}" == 'hhvm' ] && sed -i 's@fastcgi_pass unix:.*;@fastcgi_pass unix:/var/log/hhvm/sock;@g' ${web_install_dir}/conf/vhost/${domain}.conf if [ "${anti_hotlinking_flag}" == 'y' ]; then sed -i "s@^ root.*;@&\n }@" ${web_install_dir}/conf/vhost/${domain}.conf @@ -654,7 +652,7 @@ EOF echo "Reload Nginx......" ${web_install_dir}/sbin/nginx -s reload else - rm -rf ${web_install_dir}/conf/vhost/${domain}.conf + rm -f ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -683,15 +681,20 @@ Apache_log() { done if [ "${access_flag}" == 'n' ]; then - A_log='CustomLog "/dev/null" common' + Apache_log='CustomLog "/dev/null" common' else - A_log="CustomLog \"${wwwlogs_dir}/${domain}_apache.log\" common" + Apache_log="CustomLog \"${wwwlogs_dir}/${domain}_apache.log\" common" echo "You access log file=${wwwlogs_dir}/${domain}_apache.log" fi } Create_apache_conf() { - [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && R_TMP='Require all granted' || R_TMP= + if [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ]; then + Apache_grant='Require all granted' + if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then + Apache_fcgi=$(echo -e "\n Order allow,deny\n Deny from all\n \n \n SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n ") + fi + fi [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF @@ -700,11 +703,12 @@ Create_apache_conf() { ServerName ${domain} ${Apache_Domain_alias} ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" - ${A_log} + ${Apache_log} + ${Apache_fcgi} SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI - ${R_TMP} + ${Apache_grant} AllowOverride All Order allow,deny Allow from all @@ -720,11 +724,12 @@ EOF ${Apache_Domain_alias} ${Apache_SSL} ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" - ${A_log} + ${Apache_log} + ${Apache_fcgi} SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI - ${R_TMP} + ${Apache_grant} AllowOverride All Order allow,deny Allow from all @@ -739,7 +744,7 @@ EOF echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf + rm -f ${apache_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" exit 1 fi @@ -763,7 +768,7 @@ Create_nginx_apache_mod-php_conf() { server { ${Nginx_conf} server_name ${domain}${moredomainame}; - ${N_log} + ${Nginx_log} index index.html index.htm index.php; root ${vhostdir}; ${Nginx_redirect} @@ -801,12 +806,17 @@ EOF echo "Reload Nginx......" ${web_install_dir}/sbin/nginx -s reload else - rm -rf ${web_install_dir}/conf/vhost/${domain}.conf + rm -f ${web_install_dir}/conf/vhost/${domain}.conf echo "Create virtualhost ... [${CFAILURE}FAILED${CEND}]" fi # Apache - [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ] && R_TMP="Require all granted" || R_TMP= + if [ "$(${apache_install_dir}/bin/apachectl -v | awk -F'.' /version/'{print $2}')" == '4' ];then + Apache_grant="Require all granted" + if [ -e "/dev/shm/php-cgi.sock" ] && [ -n "`grep -E ^LoadModule.*mod_proxy_fcgi.so ${apache_install_dir}/conf/httpd.conf`" ]; then + Apache_fcgi=$(echo -e "\n Order allow,deny\n Deny from all\n \n \n SetHandler \"proxy:unix:/dev/shm/php-cgi.sock|fcgi://localhost\"\n ") + fi + fi [ ! -d ${apache_install_dir}/conf/vhost ] && mkdir ${apache_install_dir}/conf/vhost cat > ${apache_install_dir}/conf/vhost/${domain}.conf << EOF @@ -816,11 +826,12 @@ EOF ${Apache_Domain_alias} ${Apache_SSL} ErrorLog "${wwwlogs_dir}/${domain}_error_apache.log" - ${A_log} + ${Apache_log} + ${Apache_fcgi} SetOutputFilter DEFLATE Options FollowSymLinks ExecCGI - ${R_TMP} + ${Apache_grant} AllowOverride All Order allow,deny Allow from all @@ -835,7 +846,7 @@ EOF echo "Restart Apache......" /etc/init.d/httpd restart else - rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf + rm -f ${apache_install_dir}/conf/vhost/${domain}.conf exit 1 fi @@ -874,7 +885,7 @@ Add_Vhost() { Choose_env Input_Add_domain Create_tomcat_conf - elif [ -e "${web_install_dir}/sbin/nginx" -a -e "$(ls ${apache_install_dir}/modules/libphp?.so 2>/dev/null)" ]; then + elif [ -e "${web_install_dir}/sbin/nginx" -a -e "${apache_install_dir}/conf/httpd.conf" ]; then Choose_env Input_Add_domain Nginx_anti_hotlinking @@ -886,7 +897,6 @@ Add_Vhost() { Nginx_log Create_nginx_php-fpm_hhvm_conf elif [ "${NGX_FLAG}" == "php" ]; then - #Nginx_rewrite Nginx_log Apache_log Create_nginx_apache_mod-php_conf @@ -910,7 +920,7 @@ Del_NGX_Vhost() { else if [ -e "${web_install_dir}/conf/vhost/${domain}.conf" ]; then Directory=$(grep '^ root' ${web_install_dir}/conf/vhost/${domain}.conf | head -1 | awk -F'[ ;]' '{print $(NF-1)}') - rm -rf ${web_install_dir}/conf/vhost/${domain}.conf + rm -f ${web_install_dir}/conf/vhost/${domain}.conf ${web_install_dir}/sbin/nginx -s reload while :; do echo read -e -p "Do you want to delete Virtul Host directory? [y/n]: " Del_Vhost_wwwroot_flag @@ -943,7 +953,7 @@ Del_NGX_Vhost() { Del_Apache_Vhost() { if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then if [ -e "${web_install_dir}/sbin/nginx" ]; then - rm -rf ${apache_install_dir}/conf/vhost/${domain}.conf + rm -f ${apache_install_dir}/conf/vhost/${domain}.conf /etc/init.d/httpd restart else Domain_List=$(ls ${apache_install_dir}/conf/vhost | grep -v '0.conf' | sed "s@.conf@@g") @@ -958,7 +968,7 @@ Del_Apache_Vhost() { else if [ -e "${apache_install_dir}/conf/vhost/${domain}.conf" ]; then Directory=$(grep '^