Browse Source

Added Tomcat-6 and Apache SSL

lj2007331 8 years ago
parent
commit
51b612360c
15 changed files with 236 additions and 37 deletions
  1. 7 0
      README.md
  2. 1 1
      addons.sh
  3. 0 2
      include/apache-2.2.sh
  4. 1 0
      include/apache-2.4.sh
  5. 1 0
      include/init_CentOS.sh
  6. 3 1
      include/nginx.sh
  7. 3 1
      include/openresty.sh
  8. 3 1
      include/tengine.sh
  9. 123 0
      include/tomcat-6.sh
  10. 7 1
      include/upgrade_web.sh
  11. 25 9
      install.sh
  12. 1 1
      uninstall.sh
  13. 1 1
      upgrade.sh
  14. 10 8
      versions.txt
  15. 50 11
      vhost.sh

+ 7 - 0
README.md

@@ -39,6 +39,13 @@ screen -S oneinstack    // If network interruption, you can execute the command
 ./install.sh   // Do not sh install.sh or bash install.sh such execution
 ```
 
+## How to add PHP Extensions 
+```bash
+cd ~/oneinstack    // Must enter the directory execution under oneinstack
+./addons.sh    // Do not sh addons.sh or bash addons.sh such execution
+
+```
+
 ## How to add a virtual host
 
 ```bash

+ 1 - 1
addons.sh

@@ -21,7 +21,7 @@ printf "
 # get pwd
 sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 
-. ./apps.conf
+. ./versions.txt
 . ./options.conf
 . ./include/color.sh
 . ./include/memory.sh

+ 0 - 2
include/apache-2.2.sh

@@ -56,8 +56,6 @@ elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ];the
 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 -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf
-sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf
 sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf
 sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf
 sed -i "s@^<Directory \"$apache_install_dir/htdocs\">@<Directory \"$wwwroot_dir/default\">@" $apache_install_dir/conf/httpd.conf

+ 1 - 0
include/apache-2.4.sh

@@ -71,6 +71,7 @@ sed -i "s@AddType\(.*\)Z@AddType\1Z\n    AddType application/x-httpd-php .php .p
 sed -i "s@#AddHandler cgi-script .cgi@AddHandler cgi-script .cgi .pl@" $apache_install_dir/conf/httpd.conf
 sed -i 's@^#LoadModule rewrite_module@LoadModule rewrite_module@' $apache_install_dir/conf/httpd.conf
 sed -i 's@^#LoadModule\(.*\)mod_deflate.so@LoadModule\1mod_deflate.so@' $apache_install_dir/conf/httpd.conf
+sed -i 's@^#LoadModule\(.*\)mod_ssl.so@LoadModule\1mod_ssl.so@' $apache_install_dir/conf/httpd.conf
 sed -i 's@DirectoryIndex index.html@DirectoryIndex index.html index.php@' $apache_install_dir/conf/httpd.conf
 sed -i "s@^DocumentRoot.*@DocumentRoot \"$wwwroot_dir/default\"@" $apache_install_dir/conf/httpd.conf
 sed -i "s@^<Directory \"$apache_install_dir/htdocs\">@<Directory \"$wwwroot_dir/default\">@" $apache_install_dir/conf/httpd.conf

+ 1 - 0
include/init_CentOS.sh

@@ -14,6 +14,7 @@ yum clean all
 yum makecache
 
 if [ "$CentOS_RHEL_version" == '7' ];then
+    yum -y groupremove "Basic Web Server" "MySQL Database server" "MySQL Database client" "File and Print Server"
     yum -y install iptables-services
     systemctl mask firewalld.service
     systemctl enable iptables.service

+ 3 - 1
include/nginx.sh

@@ -12,12 +12,14 @@ Install_Nginx() {
 cd $oneinstack_dir/src
 src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
 src_url=http://nginx.org/download/nginx-$nginx_version.tar.gz && Download_src
+src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
 
 id -u $run_user >/dev/null 2>&1
 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
 
 tar xzf pcre-$pcre_version.tar.gz
 tar xzf nginx-$nginx_version.tar.gz
+tar xzf openssl-$openssl_version.tar.gz
 cd nginx-$nginx_version
 # Modify Nginx version
 #sed -i 's@#define NGINX_VERSION.*$@#define NGINX_VERSION      "1.2"@' src/core/nginx.h
@@ -36,7 +38,7 @@ elif [ "$je_tc_malloc" == '2' ];then
 fi
 
 [ ! -d "$nginx_install_dir" ] && mkdir -p $nginx_install_dir
-./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
+./configure --prefix=$nginx_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
 make -j ${THREAD} && make install
 if [ -e "$nginx_install_dir/conf/nginx.conf" ];then
     cd ..

+ 3 - 1
include/openresty.sh

@@ -12,12 +12,14 @@ Install_OpenResty() {
 cd $oneinstack_dir/src
 src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
 src_url=https://openresty.org/download/openresty-$openresty_version.tar.gz && Download_src
+src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
 
 id -u $run_user >/dev/null 2>&1
 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
 
 tar xzf pcre-$pcre_version.tar.gz
 tar xzf openresty-$openresty_version.tar.gz
+tar xzf openssl-$openssl_version.tar.gz
 cd openresty-$openresty_version
 
 # close debug
@@ -33,7 +35,7 @@ elif [ "$je_tc_malloc" == '2' ];then
 fi
 
 [ ! -d "$openresty_install_dir" ] && mkdir -p $openresty_install_dir
-./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
+./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
 make -j ${THREAD} && make install
 if [ -e "$openresty_install_dir/nginx/conf/nginx.conf" ];then
     cd ..

+ 3 - 1
include/tengine.sh

@@ -12,12 +12,14 @@ Install_Tengine() {
 cd $oneinstack_dir/src
 src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
 src_url=http://tengine.taobao.org/download/tengine-$tengine_version.tar.gz && Download_src
+src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
 
 id -u $run_user >/dev/null 2>&1
 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
 
 tar xzf pcre-$pcre_version.tar.gz
 tar xzf tengine-$tengine_version.tar.gz
+tar xzf openssl-$openssl_version.tar.gz
 cd tengine-$tengine_version
 # Modify Tengine version
 #sed -i 's@TENGINE "/" TENGINE_VERSION@"Tengine/unknown"@' src/core/nginx.h
@@ -34,7 +36,7 @@ elif [ "$je_tc_malloc" == '2' ];then
 fi
 
 [ ! -d "$tengine_install_dir" ] && mkdir -p $tengine_install_dir
-./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
+./configure --prefix=$tengine_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_concat_module=shared --with-http_sysguard_module=shared --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
 make -j ${THREAD} && make install
 if [ -e "$tengine_install_dir/conf/nginx.conf" ];then
     cd ..

+ 123 - 0
include/tomcat-6.sh

@@ -0,0 +1,123 @@
+#!/bin/bash
+# Author:  yeho <lj2007331 AT gmail.com>
+# BLOG:  https://blog.linuxeye.com
+#
+# Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
+#
+# Project home page:
+#       http://oneinstack.com
+#       https://github.com/lj2007331/oneinstack
+
+Install_tomcat-6() {
+cd $oneinstack_dir/src
+. /etc/profile
+
+src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/apache-tomcat-$tomcat_6_version.tar.gz && Download_src
+src_url=http://mirrors.linuxeye.com/apache/tomcat/v$tomcat_6_version/catalina-jmx-remote.jar && Download_src
+
+id -u $run_user >/dev/null 2>&1
+[ $? -ne 0 ] && useradd -M -s /bin/bash $run_user || { [ -z "`grep ^$run_user /etc/passwd | grep '/bin/bash'`" ] && usermod -s /bin/bash $run_user; }
+
+tar xzf apache-tomcat-$tomcat_6_version.tar.gz
+[ ! -d "$tomcat_install_dir" ] && mkdir -p $tomcat_install_dir
+/bin/cp -R apache-tomcat-$tomcat_6_version/* $tomcat_install_dir
+rm -rf $tomcat_install_dir/webapps/{docs,examples,host-manager,manager,ROOT/*}
+
+if [ -e "$tomcat_install_dir/conf/server.xml" ];then
+    /bin/cp catalina-jmx-remote.jar $tomcat_install_dir/lib
+    cd $tomcat_install_dir/lib
+    [ ! -d "$tomcat_install_dir/lib/catalina" ] &&  mkdir $tomcat_install_dir/lib/catalina
+    cd $tomcat_install_dir/lib/catalina
+    jar xf ../catalina.jar
+    sed -i 's@^server.info=.*@server.info=Tomcat@' org/apache/catalina/util/ServerInfo.properties
+    sed -i 's@^server.number=.*@server.number=6@' org/apache/catalina/util/ServerInfo.properties
+    sed -i "s@^server.built=.*@server.built=`date`@" org/apache/catalina/util/ServerInfo.properties
+    jar cf ../catalina.jar ./*
+    cd ../../bin
+    rm -rf $tomcat_install_dir/lib/catalina
+    [ "$OS" == 'CentOS' ] && yum -y install apr apr-devel
+    [[ $OS =~ ^Ubuntu$|^Debian$ ]] && apt-get -y install libapr1-dev libaprutil1-dev
+    tar xzf tomcat-native.tar.gz
+    cd tomcat-native-*-src/jni/native/
+    rm -rf /usr/local/apr
+    ./configure --with-apr=/usr/bin/apr-1-config
+    make -j ${THREAD} && make install
+    if [ -d "/usr/local/apr/lib" ];then
+        [ $Mem -le 768 ] && Xms_Mem=`expr $Mem / 3` || Xms_Mem=256
+        cat > $tomcat_install_dir/bin/setenv.sh << EOF
+JAVA_OPTS='-Djava.security.egd=file:/dev/./urandom -server -Xms${Xms_Mem}m -Xmx`expr $Mem / 2`m'
+CATALINA_OPTS="-Djava.library.path=/usr/local/apr/lib"
+# -Djava.rmi.server.hostname=$IPADDR
+# -Dcom.sun.management.jmxremote.password.file=\$CATALINA_BASE/conf/jmxremote.password
+# -Dcom.sun.management.jmxremote.access.file=\$CATALINA_BASE/conf/jmxremote.access
+# -Dcom.sun.management.jmxremote.ssl=false"
+EOF
+        cd ../../../;rm -rf tomcat-native-*
+        chmod +x $tomcat_install_dir/bin/*.sh
+        /bin/mv $tomcat_install_dir/conf/server.xml{,_bk}
+        cd $oneinstack_dir/src
+        /bin/cp ../config/server.xml $tomcat_install_dir/conf
+        sed -i "s@/usr/local/tomcat@$tomcat_install_dir@g" $tomcat_install_dir/conf/server.xml
+        sed -i /ThreadLocalLeakPreventionListener/d $tomcat_install_dir/conf/server.xml
+        if [ ! -e "$nginx_install_dir/sbin/nginx" -a ! -e "$tengine_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then
+            if [ "$OS" == 'CentOS' ];then
+                if [ -z "`grep -w '8080' /etc/sysconfig/iptables`" ];then
+                    iptables -I INPUT 5 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
+                    service iptables save
+                fi
+            elif [[ $OS =~ ^Ubuntu$|^Debian$ ]];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
+                fi
+            fi
+        fi
+
+        [ ! -d "$tomcat_install_dir/conf/vhost" ] && mkdir $tomcat_install_dir/conf/vhost
+        cat > $tomcat_install_dir/conf/vhost/localhost.xml << EOF
+<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
+  <Context path="" docBase="$wwwroot_dir/default" debug="0" reloadable="false" crossContext="true"/>
+  <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
+         prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />
+</Host>
+EOF
+        # logrotate tomcat catalina.out
+        cat > /etc/logrotate.d/tomcat << EOF
+$tomcat_install_dir/logs/catalina.out {
+daily
+rotate 5
+missingok
+dateext
+compress
+notifempty
+copytruncate
+}
+EOF
+        [ -z "`grep '<user username="admin" password=' $tomcat_install_dir/conf/tomcat-users.xml`" ] && sed -i "s@^</tomcat-users>@<role rolename=\"admin-gui\"/>\n<role rolename=\"admin-script\"/>\n<role rolename=\"manager-gui\"/>\n<role rolename=\"manager-script\"/>\n<user username=\"admin\" password=\"`cat /dev/urandom | head -1 | md5sum | head -c 10`\" roles=\"admin-gui,admin-script,manager-gui,manager-script\"/>\n</tomcat-users>@" $tomcat_install_dir/conf/tomcat-users.xml
+        cat > $tomcat_install_dir/conf/jmxremote.access << EOF
+monitorRole   readonly
+controlRole   readwrite \
+              create javax.management.monitor.*,javax.management.timer.* \
+              unregister
+EOF
+        cat > $tomcat_install_dir/conf/jmxremote.password << EOF
+monitorRole  `cat /dev/urandom | head -1 | md5sum | head -c 8`
+# controlRole   R&D
+EOF
+        chown -R $run_user.$run_user $tomcat_install_dir
+        /bin/cp ../init.d/Tomcat-init /etc/init.d/tomcat
+        sed -i "s@JAVA_HOME=.*@JAVA_HOME=$JAVA_HOME@" /etc/init.d/tomcat
+        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
+        [ "$OS" == 'CentOS' ] && { chkconfig --add tomcat; chkconfig tomcat on; }
+        [[ $OS =~ ^Ubuntu$|^Debian$ ]] && update-rc.d tomcat defaults
+        echo "${CSUCCESS}Tomcat install successfully! ${CEND}"
+    fi
+else
+    rm -rf $tomcat_install_dir
+    echo "${CFAILURE}Tomcat install failed, Please contact the author! ${CEND}"
+    kill -9 $$
+fi
+service tomcat start
+cd ..
+}

+ 7 - 1
include/upgrade_web.sh

@@ -20,7 +20,9 @@ while :; do echo
     if [ "$NEW_Nginx_version" != "$OLD_Nginx_version" ];then
         [ ! -e "nginx-$NEW_Nginx_version.tar.gz" ] && wget --no-check-certificate -c http://nginx.org/download/nginx-$NEW_Nginx_version.tar.gz > /dev/null 2>&1
         if [ -e "nginx-$NEW_Nginx_version.tar.gz" ];then
+            src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
             src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
+            tar xzf openssl-$openssl_version.tar.gz
             tar xzf pcre-$pcre_version.tar.gz
             echo "Download [${CMSG}nginx-$NEW_Nginx_version.tar.gz${CEND}] successfully! "
             break
@@ -72,7 +74,9 @@ while :; do echo
     if [ "$NEW_Tengine_version" != "$OLD_Tengine_version" ];then
         [ ! -e "tengine-$NEW_Tengine_version.tar.gz" ] && wget --no-check-certificate -c http://tengine.taobao.org/download/tengine-$NEW_Tengine_version.tar.gz > /dev/null 2>&1
         if [ -e "tengine-$NEW_Tengine_version.tar.gz" ];then
+            src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
             src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
+            tar xzf openssl-$openssl_version.tar.gz
             tar xzf pcre-$pcre_version.tar.gz
             echo "Download [${CMSG}tengine-$NEW_Tengine_version.tar.gz${CEND}] successfully! "
             break
@@ -129,7 +133,9 @@ while :; do echo
     if [ "$NEW_OpenResty_version" != "$OLD_OpenResty_version" ];then
         [ ! -e "openresty-$NEW_OpenResty_version.tar.gz" ] && wget --no-check-certificate -c https://openresty.org/download/openresty-$NEW_OpenResty_version.tar.gz > /dev/null 2>&1
         if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then
+            src_url=https://www.openssl.org/source/openssl-$openssl_version.tar.gz && Download_src
             src_url=http://mirrors.linuxeye.com/oneinstack/src/pcre-$pcre_version.tar.gz && Download_src
+            tar xzf openssl-$openssl_version.tar.gz
             tar xzf pcre-$pcre_version.tar.gz
             echo "Download [${CMSG}openresty-$NEW_OpenResty_version.tar.gz${CEND}] successfully! "
             break
@@ -155,7 +161,7 @@ if [ -e "openresty-$NEW_OpenResty_version.tar.gz" ];then
     rm -rf $$
     [ -n "`echo $openresty_configure_arguments | grep jemalloc`"] && malloc_module="--with-ld-opt='-ljemalloc'"
     [ -n "`echo $openresty_configure_arguments | grep perftools`" ] && malloc_module='--with-google_perftools_module'
-    ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
+    ./configure --prefix=$openresty_install_dir --user=$run_user --group=$run_user --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-$openssl_version --with-pcre=../pcre-$pcre_version --with-pcre-jit $malloc_module
     make -j ${THREAD}
     if [ -f "build/nginx-$openresty_version_tmp/objs/nginx" ];then
         /bin/mv $openresty_install_dir/nginx/sbin/nginx $openresty_install_dir/nginx/sbin/nginx$(date +%m%d)

+ 25 - 9
install.sh

@@ -20,7 +20,7 @@ printf "
 # get pwd
 sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 
-. ./apps.conf
+. ./versions.txt
 . ./options.conf
 . ./include/color.sh
 . ./include/check_os.sh
@@ -104,13 +104,14 @@ while :; do echo
                 echo 'Please select tomcat server:'
                 echo -e "\t${CMSG}1${CEND}. Install Tomcat-8"
                 echo -e "\t${CMSG}2${CEND}. Install Tomcat-7"
-                echo -e "\t${CMSG}3${CEND}. Do not install"
-                read -p "Please input a number:(Default 3 press Enter) " Tomcat_version
-                [ -z "$Tomcat_version" ] && Tomcat_version=3
-                if [[ ! $Tomcat_version =~ ^[1-3]$ ]];then
-                    echo "${CWARNING}input error! Please only input number 1,2,3${CEND}"
+                echo -e "\t${CMSG}3${CEND}. Install Tomcat-6"
+                echo -e "\t${CMSG}4${CEND}. Do not install"
+                read -p "Please input a number:(Default 4 press Enter) " Tomcat_version
+                [ -z "$Tomcat_version" ] && Tomcat_version=4
+                if [[ ! $Tomcat_version =~ ^[1-4]$ ]];then
+                    echo "${CWARNING}input error! Please only input number 1,2,3,4${CEND}"
                 else
-                    [ "$Tomcat_version" != '3' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; }
+                    [ "$Tomcat_version" != '4' -a -e "$tomcat_install_dir/conf/server.xml" ] && { echo "${CWARNING}Tomcat already installed! ${CEND}" ; Tomcat_version=Other; }
                     if [ "$Tomcat_version" == '1' ];then
                         while :; do echo
                             echo 'Please select JDK version:'
@@ -124,8 +125,7 @@ while :; do echo
                                 break
                             fi
                         done
-                    fi
-                    if [ "$Tomcat_version" == '2' ];then
+                    elif [ "$Tomcat_version" == '2' ];then
                         while :; do echo
                             echo 'Please select JDK version:'
                             echo -e "\t${CMSG}1${CEND}. Install JDK-1.8"
@@ -139,6 +139,19 @@ while :; do echo
                                 break
                             fi
                         done
+                    elif [ "$Tomcat_version" == '3' ];then
+                        while :; do echo
+                            echo 'Please select JDK version:'
+                            echo -e "\t${CMSG}2${CEND}. Install JDK-1.7"
+                            echo -e "\t${CMSG}3${CEND}. Install JDK-1.6"
+                            read -p "Please input a number:(Default 2 press Enter) " JDK_version
+                            [ -z "$JDK_version" ] && JDK_version=2
+                            if [[ ! $JDK_version =~ ^[2-3]$ ]];then
+                                echo "${CWARNING}input error! Please only input number 2,3${CEND}"
+                            else
+                                break
+                            fi
+                        done
                     fi
                     break
                 fi
@@ -591,6 +604,9 @@ if [ "$Tomcat_version" == '1' ];then
 elif [ "$Tomcat_version" == '2' ];then
     . include/tomcat-7.sh
     Install_tomcat-7 2>&1 | tee -a $oneinstack_dir/install.log
+elif [ "$Tomcat_version" == '3' ];then
+    . include/tomcat-6.sh
+    Install_tomcat-6 2>&1 | tee -a $oneinstack_dir/install.log
 fi
 
 # Pure-FTPd

+ 1 - 1
uninstall.sh

@@ -165,7 +165,7 @@ 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; }
 [ -e "$php_install_dir/etc/php.d/ext-memcache.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcache.ini
-[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini 
+[ -e "$php_install_dir/etc/php.d/ext-memcached.ini" ] && rm -rf $php_install_dir/etc/php.d/ext-memcached.ini
 echo "${CMSG}Memcached uninstall completed${CEND}"
 }
 

+ 1 - 1
upgrade.sh

@@ -20,7 +20,7 @@ printf "
 # get pwd
 sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 
-. ./apps.conf
+. ./versions.txt
 . ./options.conf
 . ./include/color.sh
 . ./include/check_os.sh

+ 10 - 8
apps.conf → versions.txt

@@ -3,12 +3,14 @@
 nginx_version=1.10.1
 tengine_version=2.1.1
 openresty_version=1.9.15.1
+openssl_version=1.0.2h
 
-tomcat_7_version=7.0.69
 tomcat_8_version=8.0.30
+tomcat_7_version=7.0.69
+tomcat_6_version=6.0.45
 
-apache_2_version=2.2.31
 apache_4_version=2.4.20
+apache_2_version=2.2.31
 pcre_version=8.38
 apr_version=1.5.2
 apr_util_version=1.5.4
@@ -27,16 +29,16 @@ percona_5_6_version=5.6.30-76.3
 percona_5_5_version=5.5.49-37.9
 
 # JDK
-jdk_6_version=1.6.0_45
-jdk_7_version=1.7.0_80
 jdk_8_version=1.8.0_92
+jdk_7_version=1.7.0_80
+jdk_6_version=1.6.0_45
 
 # PHP
-php_3_version=5.3.29
-php_4_version=5.4.45
-php_5_version=5.5.36
-php_6_version=5.6.22
 php_7_version=7.0.7
+php_6_version=5.6.22
+php_5_version=5.5.36
+php_4_version=5.4.45
+php_3_version=5.3.29
 
 zendopcache_version=7.0.5
 xcache_version=3.2.0

+ 50 - 11
vhost.sh

@@ -124,7 +124,7 @@ elif [ "$NGX_FLAG" == 'hhvm' ];then
 fi
 }
 
-Nginx_ssl() {
+Create_SSL() {
 printf "
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
@@ -160,17 +160,17 @@ else
   LISTENOPT='443 ssl spdy'
 fi
 
-[ ! -d "$web_install_dir/conf/ssl" ] && mkdir $web_install_dir/conf/ssl
-openssl req -new -newkey rsa:2048 -sha256 -nodes -out $web_install_dir/conf/ssl/${domain}.csr -keyout $web_install_dir/conf/ssl/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1
-/bin/cp $web_install_dir/conf/ssl/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`}
-/bin/cp $web_install_dir/conf/ssl/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`}
-openssl x509 -req -days 36500 -sha256 -in $web_install_dir/conf/ssl/${domain}.csr -signkey $web_install_dir/conf/ssl/${domain}.key -out $web_install_dir/conf/ssl/${domain}.crt > /dev/null 2>&1
+[ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL
+openssl req -new -newkey rsa:2048 -sha256 -nodes -out $PATH_SSL/${domain}.csr -keyout $PATH_SSL/${domain}.key -subj "/C=${SELFSIGNEDSSL_C}/ST=${SELFSIGNEDSSL_ST}/L=${SELFSIGNEDSSL_L}/O=${SELFSIGNEDSSL_O}/OU=${SELFSIGNEDSSL_OU}/CN=${domain}" > /dev/null 2>&1
+/bin/cp $PATH_SSL/${domain}.csr{,_bk.`date +%Y-%m-%d_%H%M`}
+/bin/cp $PATH_SSL/${domain}.key{,_bk.`date +%Y-%m-%d_%H%M`}
+openssl x509 -req -days 36500 -sha256 -in $PATH_SSL/${domain}.csr -signkey $PATH_SSL/${domain}.key -out $PATH_SSL/${domain}.crt > /dev/null 2>&1
 }
 
 Print_ssl() {
-echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$web_install_dir/conf/ssl/${domain}.crt${CEND}"
-echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$web_install_dir/conf/ssl/${domain}.key${CEND}"
-echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$web_install_dir/conf/ssl/${domain}.csr${CEND}"
+echo "`printf "%-30s" "Self-signed SSL Certificate:"`${CMSG}$PATH_SSL/${domain}.crt${CEND}"
+echo "`printf "%-30s" "SSL Private Key:"`${CMSG}$PATH_SSL/${domain}.key${CEND}"
+echo "`printf "%-30s" "SSL CSR File:"`${CMSG}$PATH_SSL/${domain}.csr${CEND}"
 }
 
 
@@ -184,8 +184,20 @@ if [ -e "$web_install_dir/sbin/nginx" ];then
             break
         fi
     done
+elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachectl" ];then
+    while :; do echo
+        read -p "Do you want to setup SSL under Apache? [y/n]: " apache_ssl_yn
+        if [[ ! $apache_ssl_yn =~ ^[y,n]$ ]];then
+            echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
+        else
+            break
+        fi
+    done
 fi
 
+[ "$apache_ssl_yn" == 'y' ] && PATH_SSL=$apache_install_dir/conf/ssl
+[ "$nginx_ssl_yn" == 'y' ] && PATH_SSL=$web_install_dir/conf/ssl
+
 while :; do echo
     read -p "Please input domain(example: www.linuxeye.com): " domain
     if [ -z "`echo $domain | grep '.*\..*'`" ]; then
@@ -243,13 +255,19 @@ if [ "$moredomainame_yn" == 'y' ]; then
 fi
 
 if [ "$nginx_ssl_yn" == 'y' ]; then
-    Nginx_ssl
-    Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $web_install_dir/conf/ssl/$domain.crt;\nssl_certificate_key $web_install_dir/conf/ssl/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;")
+    Create_SSL
+    Nginx_conf=$(echo -e "listen $LISTENOPT;\nssl_certificate $PATH_SSL/$domain.crt;\nssl_certificate_key $PATH_SSL/$domain.key;\nssl_session_timeout 10m;\nssl_protocols TLSv1 TLSv1.1 TLSv1.2;\nssl_prefer_server_ciphers on;\nssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:\!aNULL:\!eNULL:\!EXPORT:\!DES:\!3DES:\!MD5:\!DSS:\!PKS";\nssl_session_cache builtin:1000 shared:SSL:10m;\nresolver 8.8.8.8 8.8.4.4 valid=300s;\nresolver_timeout 5s;")
+    Apache_SSL=$(echo -e "SSLEngine on\n    SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n    SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"")
     if [ "$moredomainame_yn" == 'y' ]; then
         Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain$moredomainame;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}")
     else
         Nginx_http_to_https=$(echo -e "server {\nlisten 80;\nserver_name $domain;\nrewrite ^/(.*) https://$domain/\$1 permanent;\n}")
     fi
+elif [ "$apache_ssl_yn" == 'y' ]; then
+    Create_SSL
+    Apache_SSL=$(echo -e "SSLEngine on\n    SSLCertificateFile \"$PATH_SSL/$domain.crt\"\n    SSLCertificateKeyFile \"$PATH_SSL/$domain.key\"")
+    [ -z "`grep 'Listen 443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@Listen 80@&\nListen 443@" $apache_install_dir/conf/httpd.conf
+    [ -z "`grep 'ServerName 0.0.0.0:443' $apache_install_dir/conf/httpd.conf`" ] && sed -i "s@ServerName 0.0.0.0:80@&\nServerName 0.0.0.0:443@" $apache_install_dir/conf/httpd.conf
 else
     Nginx_conf='listen 80;'
 fi
@@ -524,6 +542,26 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF
 </Directory>
 </VirtualHost>
 EOF
+[ "$apache_ssl_yn" == 'y' ] && cat >> $apache_install_dir/conf/vhost/$domain.conf << EOF
+<VirtualHost *:443>
+    ServerAdmin admin@linuxeye.com
+    DocumentRoot "$vhostdir"
+    ServerName $domain
+    $Apache_Domain_alias
+    $Apache_SSL
+    ErrorLog "$wwwlogs_dir/${domain}_error_apache.log"
+    $A_log
+<Directory "$vhostdir">
+    SetOutputFilter DEFLATE
+    Options FollowSymLinks ExecCGI
+    $R_TMP
+    AllowOverride All
+    Order allow,deny
+    Allow from all
+    DirectoryIndex index.html index.php
+</Directory>
+</VirtualHost>
+EOF
 
 echo
 $apache_install_dir/bin/apachectl -t
@@ -601,6 +639,7 @@ cat > $apache_install_dir/conf/vhost/$domain.conf << EOF
     DocumentRoot "$vhostdir"
     ServerName $domain
     $Apache_Domain_alias
+    $Apache_SSL
     ErrorLog "$wwwlogs_dir/${domain}_error_apache.log"
     $A_log
 <Directory "$vhostdir">