Browse Source

Apache2.4 enable http2 and Update Tomcat version

lj2007331 8 years ago
parent
commit
e4e1985d82

+ 1 - 1
README.md

@@ -17,7 +17,7 @@ Script properties:
 - Install memcached, redis according to their needs
 - Jemalloc optimize MySQL, Nginx
 - Providing add a virtual host script, include Let's Encrypt SSL certificate
-- Provide Nginx/Tengine, MySQL/MariaDB/Percona, PHP, Redis, phpMyAdmin upgrade script
+- Provide Nginx/Tengine/OpenResty, MySQL/MariaDB/Percona, PHP, Redis, Memcached, phpMyAdmin upgrade script
 - Provide local backup and remote backup (rsync between servers) script
 - Provided under HHVM install CentOS 6,7
 

+ 1 - 1
include/alisql-5.6.sh

@@ -158,7 +158,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 32 - 32
include/apache-2.2.sh

@@ -10,52 +10,52 @@
 
 Install_Apache22() {
   pushd ${oneinstack_dir}/src
-  id -u $run_user >/dev/null 2>&1
-  [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
-  tar xzf httpd-$apache22_version.tar.gz
-  pushd httpd-$apache22_version
-  [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir
+  id -u ${run_user} >/dev/null 2>&1
+  [ $? -ne 0 ] && useradd -M -s /sbin/nologin ${run_user}
+  tar xzf httpd-${apache22_version}.tar.gz
+  pushd httpd-${apache22_version}
+  [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir}
   [ "${Ubuntu_version}" == "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 --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
+  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 --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
   make -j ${THREAD} && make install
   unset LDFLAGS
-  if [ -e "$apache_install_dir/conf/httpd.conf" ]; then
+  if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then
     echo "${CSUCCESS}Apache installed successfully! ${CEND}"
     popd
-    rm -rf httpd-$apache22_version
+    rm -rf httpd-${apache22_version}
   else
-    rm -rf $apache_install_dir
+    rm -rf ${apache_install_dir}
     echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}"
     kill -9 $$
   fi
 
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${apache_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${apache_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
-  /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd
+  /bin/cp ${apache_install_dir}/bin/apachectl /etc/init.d/httpd
   sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd
   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
   [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; }
   [[ $OS =~ ^Ubuntu$|^Debian$ ]] && 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
-  if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then
-    sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf
+  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
+  if [ "${Nginx_version}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
+    sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=80
-  elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then
-    sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf
-    sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf
+  elif [[ ${Nginx_version} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
+    sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf
+    sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=88
   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@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
-  sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf
+  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@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
+  sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf
   
   #logrotate apache log
   cat > /etc/logrotate.d/apache << EOF
@@ -73,8 +73,8 @@ $wwwlogs_dir/*apache.log {
 }
 EOF
 
-  mkdir $apache_install_dir/conf/vhost
-  cat > $apache_install_dir/conf/vhost/0.conf << EOF
+  mkdir ${apache_install_dir}/conf/vhost
+  cat > ${apache_install_dir}/conf/vhost/0.conf << EOF
 NameVirtualHost *:$TMP_PORT
 <VirtualHost *:$TMP_PORT>
   ServerAdmin admin@linuxeye.com
@@ -99,7 +99,7 @@ NameVirtualHost *:$TMP_PORT
 </VirtualHost>
 EOF
 
-  cat >> $apache_install_dir/conf/httpd.conf <<EOF
+  cat >> ${apache_install_dir}/conf/httpd.conf <<EOF
 <IfModule mod_headers.c>
   AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
   <FilesMatch "\.(js|css|html|htm|png|jpg|swf|pdf|shtml|xml|flv|gif|ico|jpeg)\$">
@@ -116,14 +116,14 @@ ServerSignature Off
 Include conf/vhost/*.conf
 EOF
 
-  if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then
-    $apache_install_dir/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c
-    cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF
+  if [ "${Nginx_version}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
+    ${apache_install_dir}/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c
+    cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF
 LoadModule remoteip_module modules/mod_remoteip.so
 RemoteIPHeader X-Forwarded-For
 RemoteIPInternalProxy 127.0.0.1
 EOF
-    sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf
+    sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" ${apache_install_dir}/conf/httpd.conf
   fi
   ldconfig
   service httpd start

+ 70 - 43
include/apache-2.4.sh

@@ -10,66 +10,91 @@
 
 Install_Apache24() {
   pushd ${oneinstack_dir}/src
-  tar xzf pcre-$pcre_version.tar.gz
-  pushd pcre-$pcre_version
+  tar xzf pcre-${pcre_version}.tar.gz
+  pushd pcre-${pcre_version}
   ./configure
   make -j ${THREAD} && make install
   popd
-  id -u $run_user >/dev/null 2>&1
+  id -u ${run_user} >/dev/null 2>&1
   [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
-  tar xzf httpd-$apache24_version.tar.gz
-  tar xzf apr-$apr_version.tar.gz
-  tar xzf apr-util-$apr_util_version.tar.gz
-  pushd httpd-$apache24_version
-  [ ! -d "$apache_install_dir" ] && mkdir -p $apache_install_dir
-  /bin/cp -R ../apr-$apr_version ./srclib/apr
-  /bin/cp -R ../apr-util-$apr_util_version ./srclib/apr-util
-  LDFLAGS=-ldl ./configure --prefix=$apache_install_dir --with-mpm=prefork --with-included-apr --enable-headers --enable-deflate --enable-so --enable-dav --enable-rewrite --enable-ssl --with-ssl --enable-expires --enable-static-support --enable-suexec --enable-modules=all --enable-mods-shared=all
+  tar xzf httpd-${apache24_version}.tar.gz
+  tar xzf nghttp2-${nghttp2_version}.tar.gz
+  tar xzf apr-${apr_version}.tar.gz
+  tar xzf apr-util-${apr_util_version}.tar.gz
+
+  # install openssl-1.0.2
+  if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
+    tar xzf ${openssl_version}.tar.gz
+    pushd ${openssl_version}
+    ./config --prefix=${openssl_install_dir} -fPIC shared zlib
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi
+
+  # install nghttp2
+  if [ ! -e "/usr/local/lib/libnghttp2.so" ]; then
+    pushd nghttp2-${nghttp2_version}
+    ./configure
+    make -j ${THREAD} && make install
+    popd
+    echo '/usr/local/lib' > /etc/ld.so.conf.d/local.conf; ldconfig
+    rm -rf nghttp2-${nghttp2_version}
+  fi
+
+  pushd httpd-${apache24_version}
+  [ ! -d "${apache_install_dir}" ] && mkdir -p ${apache_install_dir}
+  /bin/cp -R ../apr-${apr_version} ./srclib/apr
+  /bin/cp -R ../apr-util-${apr_util_version} ./srclib/apr-util
+  LDFLAGS=-ldl LD_LIBRARY_PATH=${openssl_install_dir}/lib ./configure --prefix=${apache_install_dir} --with-mpm=prefork --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
   make -j ${THREAD} && make install
   unset LDFLAGS
-  if [ -e "$apache_install_dir/conf/httpd.conf" ]; then
+  if [ -e "${apache_install_dir}/conf/httpd.conf" ]; then
     echo "${CSUCCESS}Apache installed successfully! ${CEND}"
     popd 
-    rm -rf httpd-$apache24_version
+    rm -rf httpd-${apache24_version}
   else
-    rm -rf $apache_install_dir
+    rm -rf ${apache_install_dir}
     echo "${CFAILURE}Apache install failed, Please contact the author! ${CEND}"
     kill -9 $$
   fi
 
-  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=$apache_install_dir/bin:\$PATH" >> /etc/profile
-  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep $apache_install_dir /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=$apache_install_dir/bin:\1@" /etc/profile
+  [ -z "`grep ^'export PATH=' /etc/profile`" ] && echo "export PATH=${apache_install_dir}/bin:\$PATH" >> /etc/profile
+  [ -n "`grep ^'export PATH=' /etc/profile`" -a -z "`grep ${apache_install_dir} /etc/profile`" ] && sed -i "s@^export PATH=\(.*\)@export PATH=${apache_install_dir}/bin:\1@" /etc/profile
   . /etc/profile
   
-  /bin/cp $apache_install_dir/bin/apachectl /etc/init.d/httpd
+  sed -i "s@^export LD_LIBRARY_PATH.*@export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${openssl_install_dir}/lib@" ${apache_install_dir}/bin/envvars
+
+  /bin/cp ${apache_install_dir}/bin/apachectl /etc/init.d/httpd
   sed -i '2a # chkconfig: - 85 15' /etc/init.d/httpd
   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
   [ "$OS" == 'CentOS' ] && { chkconfig --add httpd; chkconfig httpd on; }
   [[ $OS =~ ^Ubuntu$|^Debian$ ]] && 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
-  if [ "$Nginx_version" == '4' -a ! -e "$web_install_dir/sbin/nginx" ]; then
-    sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' $apache_install_dir/conf/httpd.conf
+  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
+  if [ "${Nginx_version}" == '4' -a ! -e "${web_install_dir}/sbin/nginx" ]; then
+    sed -i 's/^#ServerName www.example.com:80/ServerName 0.0.0.0:80/' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=80
-  elif [[ $Nginx_version =~ ^[1-3]$ ]] || [ -e "$web_install_dir/sbin/nginx" ]; then
-    sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' $apache_install_dir/conf/httpd.conf
-    sed -i 's@^Listen.*@Listen 127.0.0.1:88@' $apache_install_dir/conf/httpd.conf
+  elif [[ ${Nginx_version} =~ ^[1-3]$ ]] || [ -e "${web_install_dir}/sbin/nginx" ]; then
+    sed -i 's/^#ServerName www.example.com:80/ServerName 127.0.0.1:88/' ${apache_install_dir}/conf/httpd.conf
+    sed -i 's@^Listen.*@Listen 127.0.0.1:88@' ${apache_install_dir}/conf/httpd.conf
     TMP_PORT=88
   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_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
-  sed -ri 's@^#(.*mod_deflate.so)@\1@' $apache_install_dir/conf/httpd.conf
-  sed -ri 's@^#(.*mod_expires.so)@\1@' $apache_install_dir/conf/httpd.conf
-  sed -ri 's@^#(.*mod_ssl.so)@\1@' $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
-  sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" $apache_install_dir/conf/httpd.conf
+  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_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
+  sed -ri 's@^#(.*mod_deflate.so)@\1@' ${apache_install_dir}/conf/httpd.conf
+  sed -ri 's@^#(.*mod_expires.so)@\1@' ${apache_install_dir}/conf/httpd.conf
+  sed -ri 's@^#(.*mod_ssl.so)@\1@' ${apache_install_dir}/conf/httpd.conf
+  sed -ri 's@^#(.*mod_http2.so)@\1@' ${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
+  sed -i "s@^#Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf@" ${apache_install_dir}/conf/httpd.conf
   
   #logrotate apache log
   cat > /etc/logrotate.d/apache << EOF
@@ -87,8 +112,8 @@ $wwwlogs_dir/*apache.log {
 }
 EOF
 
-  mkdir $apache_install_dir/conf/vhost
-  cat > $apache_install_dir/conf/vhost/0.conf << EOF
+  mkdir ${apache_install_dir}/conf/vhost
+  cat > ${apache_install_dir}/conf/vhost/0.conf << EOF
 <VirtualHost *:$TMP_PORT>
   ServerAdmin admin@linuxeye.com
   DocumentRoot "$wwwroot_dir/default"
@@ -113,7 +138,7 @@ EOF
 </VirtualHost>
 EOF
 
-  cat >> $apache_install_dir/conf/httpd.conf <<EOF
+  cat >> ${apache_install_dir}/conf/httpd.conf <<EOF
 <IfModule mod_headers.c>
   AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript
   <FilesMatch "\.(js|css|html|htm|png|jpg|swf|pdf|shtml|xml|flv|gif|ico|jpeg)\$">
@@ -124,20 +149,22 @@ EOF
   SetOutputFilter DEFLATE
 </IfModule>
 
+ProtocolsHonorOrder On
+Protocols h2 http/1.1
 PidFile /var/run/httpd.pid
 ServerTokens ProductOnly
 ServerSignature Off
 Include conf/vhost/*.conf
 EOF
 
-  if [ "$Nginx_version" != '4' -o -e "$web_install_dir/sbin/nginx" ]; then
-    cat > $apache_install_dir/conf/extra/httpd-remoteip.conf << EOF
+  if [ "${Nginx_version}" != '4' -o -e "${web_install_dir}/sbin/nginx" ]; then
+    cat > ${apache_install_dir}/conf/extra/httpd-remoteip.conf << EOF
 LoadModule remoteip_module modules/mod_remoteip.so
 RemoteIPHeader X-Forwarded-For
 RemoteIPInternalProxy 127.0.0.1
 EOF
-    sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" $apache_install_dir/conf/httpd.conf
-    sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" $apache_install_dir/conf/httpd.conf
+    sed -i "s@Include conf/extra/httpd-mpm.conf@Include conf/extra/httpd-mpm.conf\nInclude conf/extra/httpd-remoteip.conf@" ${apache_install_dir}/conf/httpd.conf
+    sed -i "s@LogFormat \"%h %l@LogFormat \"%h %a %l@g" ${apache_install_dir}/conf/httpd.conf
   fi
   ldconfig
   service httpd start

+ 2 - 0
include/check_download.sh

@@ -84,6 +84,8 @@ checkDownload() {
           JDK_FILE="jdk-$(echo ${jdk16_version} | awk -F. '{print $2}')u$(echo ${jdk16_version} | awk -F_ '{print $NF}')-linux-${SYS_BIG_FLAG}.bin"
           ;;
       esac
+      echo "Download apr..."
+      src_url=http://archive.apache.org/dist/apr/apr-${apr_version}.tar.gz && Download_src
       # start download...
       src_url=http://mirrors.linuxeye.com/jdk/${JDK_FILE} && Download_src
     fi

+ 1 - 1
include/mariadb-10.0.sh

@@ -163,7 +163,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/mariadb-10.1.sh

@@ -163,7 +163,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/mariadb-5.5.sh

@@ -166,7 +166,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/mysql-5.5.sh

@@ -169,7 +169,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/mysql-5.6.sh

@@ -168,7 +168,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/mysql-5.7.sh

@@ -169,7 +169,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/percona-5.5.sh

@@ -170,7 +170,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/percona-5.6.sh

@@ -170,7 +170,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 1 - 1
include/percona-5.7.sh

@@ -170,7 +170,7 @@ read_buffer = 4M
 write_buffer = 4M
 EOF
 
-  sed -i "s@max_connections.*@max_connections = $((${Mem}/2))@" /etc/my.cnf
+  sed -i "s@max_connections.*@max_connections = $((${Mem}/3))@" /etc/my.cnf
   if [ ${Mem} -gt 1500 -a ${Mem} -le 2500 ]; then
     sed -i 's@^thread_cache_size.*@thread_cache_size = 16@' /etc/my.cnf
     sed -i 's@^query_cache_size.*@query_cache_size = 16M@' /etc/my.cnf

+ 4 - 4
include/php-5.3.sh

@@ -21,15 +21,15 @@ Install_PHP53() {
   
   # Problem building php-5.3 with openssl
   if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then
-    if [ ! -e '/usr/local/openssl/lib/libcrypto.a' ]; then
+    if [ ! -e '/usr/local/openssl100s/lib/libcrypto.a' ]; then
       tar xzf openssl-1.0.0s.tar.gz
       pushd openssl-1.0.0s
-      ./config --prefix=/usr/local/openssl -fPIC shared zlib
+      ./config --prefix=/usr/local/openssl100s -fPIC shared zlib
       make -j ${THREAD} && make install
       popd 
       rm -rf openssl-1.0.0s
     fi
-    OpenSSL_args='--with-openssl=/usr/local/openssl'
+    OpenSSL_args='--with-openssl=/usr/local/openssl100s'
   else
     OpenSSL_args='--with-openssl'
   fi
@@ -37,7 +37,7 @@ Install_PHP53() {
   if [ "$Debian_version" == '8' -o "$Ubuntu_version" == '16' ]; then
     tar xzf curl-7.35.0.tar.gz
     pushd curl-7.35.0
-    LDFLAGS="-Wl,-rpath=/usr/local/openssl/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl
+    LDFLAGS="-Wl,-rpath=/usr/local/openssl100s/lib" ./configure --prefix=/usr/local --with-ssl=/usr/local/openssl100s
   else
     tar xzf curl-$curl_version.tar.gz
     pushd curl-$curl_version

+ 23 - 6
include/tomcat-6.sh

@@ -15,6 +15,26 @@ Install_Tomcat6() {
   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}; }
 
+  # install openssl-1.0.2
+  if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
+    tar xzf ${openssl_version}.tar.gz
+    pushd ${openssl_version}
+    ./config --prefix=${openssl_install_dir} -fPIC shared zlib
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi
+
+  # install apr
+  if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then
+    tar xzf ${apr_version}.tar.gz
+    pushd ${apr_version}
+    ./configure
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi
+
   tar xzf apache-tomcat-${tomcat6_version}.tar.gz
   [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir}
   /bin/cp -R apache-tomcat-${tomcat6_version}/* ${tomcat_install_dir}
@@ -37,17 +57,14 @@ Install_Tomcat6() {
   popd
   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
   pushd ${tomcat_install_dir}/bin
   tar xzf tomcat-native.tar.gz
-  pushd tomcat-native-*-src/jni/native/
-    rm -rf /usr/local/apr
-    ./configure --with-apr=/usr/bin/apr-1-config
+  pushd tomcat-native-*-src/native
+    ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir}
     make -j ${THREAD} && make install
   popd
   rm -rf tomcat-native-*
-  if [ -d "/usr/local/apr/lib" ]; then
+  if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then
     [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256
     let XmxMem="${Mem}/2"
     cat > ${tomcat_install_dir}/bin/setenv.sh << EOF

+ 23 - 6
include/tomcat-7.sh

@@ -15,6 +15,26 @@ Install_Tomcat7() {
   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}; }
 
+  # install openssl-1.0.2
+  if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
+    tar xzf ${openssl_version}.tar.gz
+    pushd ${openssl_version}
+    ./config --prefix=${openssl_install_dir} -fPIC shared zlib
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi  
+
+  # install apr
+  if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then
+    tar xzf ${apr_version}.tar.gz
+    pushd ${apr_version}
+    ./configure
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi
+
   tar xzf apache-tomcat-${tomcat7_version}.tar.gz
   [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir}
   /bin/cp -R apache-tomcat-${tomcat7_version}/* ${tomcat_install_dir}
@@ -37,17 +57,14 @@ Install_Tomcat7() {
   popd
   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
   pushd ${tomcat_install_dir}/bin
   tar xzf tomcat-native.tar.gz
-  pushd tomcat-native-*-src/jni/native/
-    rm -rf /usr/local/apr
-    ./configure --with-apr=/usr/bin/apr-1-config
+  pushd tomcat-native-*-src/native
+    ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir}
     make -j ${THREAD} && make install
   popd
   rm -rf tomcat-native-*
-  if [ -d "/usr/local/apr/lib" ]; then
+  if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then
     [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256
     let XmxMem="${Mem}/2"
     cat > ${tomcat_install_dir}/bin/setenv.sh << EOF

+ 23 - 6
include/tomcat-8.sh

@@ -15,6 +15,26 @@ Install_Tomcat8() {
   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}; }
 
+  # install openssl-1.0.2
+  if [ ! -e "${openssl_install_dir}/lib/libcrypto.a" ]; then
+    tar xzf ${openssl_version}.tar.gz
+    pushd ${openssl_version}
+    ./config --prefix=${openssl_install_dir} -fPIC shared zlib
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi  
+
+  # install apr
+  if [ ! -e "/usr/local/apr/bin/apr-1-config" ]; then
+    tar xzf ${apr_version}.tar.gz
+    pushd ${apr_version}
+    ./configure
+    make -j ${THREAD} && make install
+    popd
+    rm -rf ${openssl_version}
+  fi
+
   tar xzf apache-tomcat-${tomcat8_version}.tar.gz
   [ ! -d "${tomcat_install_dir}" ] && mkdir -p ${tomcat_install_dir}
   /bin/cp -R apache-tomcat-${tomcat8_version}/* ${tomcat_install_dir}
@@ -37,17 +57,14 @@ Install_Tomcat8() {
   popd
   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
   pushd ${tomcat_install_dir}/bin
   tar xzf tomcat-native.tar.gz
-  pushd tomcat-native-*-src/jni/native/
-    rm -rf /usr/local/apr
-    ./configure --with-apr=/usr/bin/apr-1-config
+  pushd tomcat-native-*-src/native
+    ./configure --with-apr=/usr/local/apr --with-ssl=${openssl_install_dir}
     make -j ${THREAD} && make install
   popd
   rm -rf tomcat-native-*
-  if [ -d "/usr/local/apr/lib" ]; then
+  if [ -e "/usr/local/apr/lib/libtcnative-1.la" ]; then
     [ ${Mem} -le 768 ] && let Xms_Mem="${Mem}/3" || Xms_Mem=256
     let XmxMem="${Mem}/2"
     cat > ${tomcat_install_dir}/bin/setenv.sh << EOF

+ 2 - 0
options.conf

@@ -26,6 +26,8 @@ redis_install_dir=/usr/local/redis
 
 python_install_dir=/usr/local/python
 
+openssl_install_dir=/usr/local/openssl
+
 # Add modules
 nginx_modules_options=''
 php_modules_options=''

+ 1 - 1
upgrade.sh

@@ -13,7 +13,7 @@ clear
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#     upgrade Web,DB,PHP,Redis,Memcached,phpMyAdmin for OneinStack    #
+#              Upgrade Software versions for OneinStack               # 
 #       For more information please visit https://oneinstack.com      #
 #######################################################################
 "

+ 7 - 6
versions.txt

@@ -5,15 +5,16 @@ tengine_version=2.1.2
 openresty_version=1.11.2.2
 openssl_version=1.0.2j
 
-tomcat8_version=8.0.30
-tomcat7_version=7.0.69
-tomcat6_version=6.0.45
+tomcat8_version=8.0.39
+tomcat7_version=7.0.73
+tomcat6_version=6.0.48
 
 apache24_version=2.4.25
 apache22_version=2.2.31
 pcre_version=8.39
 apr_version=1.5.2
 apr_util_version=1.5.4
+nghttp2_version=1.18.1
 
 # DB
 mysql57_version=5.7.17
@@ -22,13 +23,13 @@ mysql55_version=5.5.54
 
 mariadb101_version=10.1.20
 mariadb100_version=10.0.28
-mariadb55_version=5.5.53
+mariadb55_version=5.5.54
 
 percona57_version=5.7.16-10
 percona56_version=5.6.34-79.1
 percona55_version=5.5.53-38.5
 
-alisql56_version=5.6.32-2
+alisql56_version=5.6.32-3
 
 # JDK
 jdk18_version=1.8.0_112
@@ -47,7 +48,7 @@ zendopcache_version=7.0.5
 xcache_version=3.2.0
 apcu_version=4.0.11
 apcu_for_php7_version=5.1.7
-ImageMagick_version=6.9.7-0
+ImageMagick_version=6.9.7-2
 imagick_version=3.4.3RC1
 imagick_for_php53_version=3.3.0
 GraphicsMagick_version=1.3.25

+ 1 - 1
vhost.sh

@@ -205,7 +205,7 @@ Create_SSL() {
       if [ "${nginx_ssl_yn}" == 'y' ]; then 
         [ ! -d ${web_install_dir}/conf/vhost ] && mkdir ${web_install_dir}/conf/vhost
         echo "server {  server_name ${domain}${moredomainame};  root ${vhostdir};  access_log off; }" > ${web_install_dir}/conf/vhost/${domain}.conf
-        /etc/init.d/nginx reload > /dev/null
+        ${web_install_dir}/sbin/nginx -s reload
       fi
 
       if [ "${apache_ssl_yn}" == 'y' ]; then