Browse Source

Add Let’s Encrypt

lj2007331 8 years ago
parent
commit
2f4f0b84bf
69 changed files with 256 additions and 140 deletions
  1. 1 1
      README.md
  2. 73 10
      addons.sh
  3. 1 1
      backup.sh
  4. 2 2
      backup_setup.sh
  5. 1 1
      include/GraphicsMagick.sh
  6. 1 1
      include/ImageMagick.sh
  7. 1 1
      include/ZendGuardLoader.sh
  8. 1 1
      include/apache-2.2.sh
  9. 1 1
      include/apache-2.4.sh
  10. 1 1
      include/apcu.sh
  11. 1 1
      include/check_dir.sh
  12. 4 4
      include/check_os.sh
  13. 1 1
      include/color.sh
  14. 1 1
      include/demo.sh
  15. 1 1
      include/download.sh
  16. 1 1
      include/eaccelerator-0.9.sh
  17. 1 1
      include/eaccelerator-1.0-dev.sh
  18. 1 1
      include/get_char.sh
  19. 3 11
      include/hhvm_CentOS.sh
  20. 6 6
      include/init_CentOS.sh
  21. 7 7
      include/init_Debian.sh
  22. 6 5
      include/init_Ubuntu.sh
  23. 1 1
      include/ioncube.sh
  24. 1 1
      include/jdk-1.6.sh
  25. 1 1
      include/jdk-1.7.sh
  26. 1 1
      include/jdk-1.8.sh
  27. 1 1
      include/jemalloc.sh
  28. 1 1
      include/mariadb-10.0.sh
  29. 1 1
      include/mariadb-10.1.sh
  30. 1 1
      include/mariadb-5.5.sh
  31. 1 1
      include/memcached.sh
  32. 1 1
      include/memory.sh
  33. 1 1
      include/mysql-5.5.sh
  34. 1 1
      include/mysql-5.6.sh
  35. 1 1
      include/mysql-5.7.sh
  36. 1 1
      include/nginx.sh
  37. 1 1
      include/openresty.sh
  38. 1 1
      include/percona-5.5.sh
  39. 1 1
      include/percona-5.6.sh
  40. 1 1
      include/percona-5.7.sh
  41. 1 1
      include/php-5.3.sh
  42. 1 1
      include/php-5.4.sh
  43. 1 1
      include/php-5.5.sh
  44. 1 1
      include/php-5.6.sh
  45. 1 1
      include/php-7.sh
  46. 1 1
      include/phpmyadmin.sh
  47. 1 1
      include/pureftpd.sh
  48. 1 1
      include/redis.sh
  49. 1 1
      include/tcmalloc.sh
  50. 1 1
      include/tengine.sh
  51. 1 1
      include/tomcat-6.sh
  52. 1 1
      include/tomcat-7.sh
  53. 1 1
      include/tomcat-8.sh
  54. 1 1
      include/upgrade_db.sh
  55. 1 1
      include/upgrade_php.sh
  56. 1 1
      include/upgrade_phpmyadmin.sh
  57. 1 1
      include/upgrade_redis.sh
  58. 1 1
      include/upgrade_web.sh
  59. 1 1
      include/xcache.sh
  60. 1 1
      include/zendopcache.sh
  61. 2 2
      install.sh
  62. 2 2
      pureftpd_vhost.sh
  63. 2 2
      reset_db_root_password.sh
  64. 4 4
      shadowsocks.sh
  65. 1 1
      tools/db_bk.sh
  66. 1 1
      tools/website_bk.sh
  67. 2 2
      uninstall.sh
  68. 2 2
      upgrade.sh
  69. 86 26
      vhost.sh

+ 1 - 1
README.md

@@ -128,4 +128,4 @@ service memcached {start|stop|status|restart|reload}
 
 ## Installation
 For feedback, questions, and to follow the progress of the project (Chinese): <br />
-[OneinStack](http://oneinstack.com)<br />
+[OneinStack](https://oneinstack.com)<br />

+ 73 - 10
addons.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #                  Install/Uninstall PHP Extensions                   #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 
@@ -50,9 +50,8 @@ sed -i "s@^oneinstack_dir.*@oneinstack_dir=`pwd`@" ./options.conf
 
 # Check PHP
 if [ -e "$php_install_dir/bin/phpize" ];then
-    PHP_version=`$php_install_dir/bin/php -r 'echo PHP_VERSION;' | awk -F. '{print $1"."$2}'`
-else
-    echo "${CWARNING}PHP is not installed on your system! You can use to uninstall and reinstall PHP Extensions${CEND}"; exit 1
+    PHP_version_detail=`$php_install_dir/bin/php -r 'echo PHP_VERSION;'`
+    PHP_version=`echo $PHP_version_detail | awk -F. '{print $1"."$2}'`
 fi
 
 # Check PHP Extensions
@@ -95,6 +94,42 @@ opcache.enable_cli=1
 EOF
 }
 
+Install_letsencrypt() {
+if [ "$CentOS_RHEL_version" == '7' ];then
+    [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
+[epel]
+name=Extra Packages for Enterprise Linux 7 - \$basearch
+#baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+EOF
+elif [ "$CentOS_RHEL_version" == '6' ];then
+    [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
+[epel]
+name=Extra Packages for Enterprise Linux 6 - \$basearch
+#baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
+mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=\$basearch
+failovermethod=priority
+enabled=1
+gpgcheck=0
+EOF
+fi
+
+cd $oneinstack_dir/src
+src_url=https://dl.eff.org/certbot-auto && Download_src
+/bin/mv certbot-auto /usr/local/bin/
+chmod +x /usr/local/bin/certbot-auto
+certbot-auto --help all
+certbot-auto -h | grep '\-\-standalone' > /dev/null && echo; echo "${CSUCCESS}Let's Encrypt client install successfully! ${CEND}"
+}
+
+Uninstall_letsencrypt() {
+rm -rf /usr/local/bin/cerbot-auto /etc/letsencrypt /var/log/letsencrypt
+echo; echo "${CMSG}Let's Encrypt client uninstall completed${CEND}";
+}
+
 ACTION_FUN() {
 while :; do
     echo
@@ -117,13 +152,15 @@ What Are You Doing?
 \t${CMSG}1${CEND}. Install/Uninstall PHP opcode cache
 \t${CMSG}2${CEND}. Install/Uninstall ZendGuardLoader/ionCube PHP Extension
 \t${CMSG}3${CEND}. Install/Uninstall ImageMagick/GraphicsMagick PHP Extension
-\t${CMSG}4${CEND}. Install/Uninstall memcached/memcache
-\t${CMSG}5${CEND}. Install/Uninstall Redis
+\t${CMSG}4${CEND}. Install/Uninstall fileinfo PHP Extension 
+\t${CMSG}5${CEND}. Install/Uninstall memcached/memcache
+\t${CMSG}6${CEND}. Install/Uninstall Redis
+\t${CMSG}7${CEND}. Install/Uninstall Let's Encrypt client
 \t${CMSG}q${CEND}. Exit
 "
     read -p "Please input the correct option: " Number
-    if [[ ! $Number =~ ^[1-5,q]$ ]];then
-        echo "${CFAILURE}input error! Please only input 1 ~ 5 and q${CEND}"
+    if [[ ! $Number =~ ^[1-7,q]$ ]];then
+        echo "${CFAILURE}input error! Please only input 1 ~ 7 and q${CEND}"
     else
         case "$Number" in
         1)
@@ -277,6 +314,24 @@ What Are You Doing?
             fi
             ;;
         4)
+            ACTION_FUN
+            PHP_extension=fileinfo
+            if [ $ACTION = 1 ];then
+                Check_PHP_Extension
+                cd $oneinstack_dir/src
+                src_url=http://www.php.net/distributions/php-$PHP_version_detail.tar.gz && Download_src
+                tar xzf php-$PHP_version_detail.tar.gz
+                cd php-$PHP_version_detail/ext/fileinfo
+                $php_install_dir/bin/phpize
+                ./configure --with-php-config=$php_install_dir/bin/php-config
+                make -j ${THREAD} && make install
+                echo 'extension=fileinfo.so' > $php_install_dir/etc/php.d/ext-fileinfo.ini
+                Check_succ
+            else
+                Uninstall_succ
+            fi
+            ;;
+        5)
             ACTION_FUN
             while :; do echo
                 echo 'Please select memcache/memcached PHP Extension:'
@@ -318,7 +373,7 @@ What Are You Doing?
                 [ -e "$memcached_install_dir" ] && { service memcached stop > /dev/null 2>&1; rm -rf $memcached_install_dir /etc/init.d/memcached /usr/bin/memcached; }
             fi
             ;;
-        5)
+        6)
             ACTION_FUN
             PHP_extension=redis
             if [ $ACTION = 1 ];then
@@ -330,6 +385,14 @@ What Are You Doing?
                 [ -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-*; }
             fi
             ;;
+        7)
+            ACTION_FUN
+            if [ $ACTION = 1 ];then
+                Install_letsencrypt
+            else
+                Uninstall_letsencrypt
+            fi
+            ;;
         q)
             exit
             ;;

+ 1 - 1
backup.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 cd tools

+ 2 - 2
backup_setup.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #                     Setup the backup parameters                     #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 

+ 1 - 1
include/GraphicsMagick.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_GraphicsMagick() {

+ 1 - 1
include/ImageMagick.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ImageMagick() {

+ 1 - 1
include/ZendGuardLoader.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ZendGuardLoader()

+ 1 - 1
include/apache-2.2.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Apache-2-2() {

+ 1 - 1
include/apache-2.4.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Apache-2-4() {

+ 1 - 1
include/apcu.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_APCU() {

+ 1 - 1
include/check_dir.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 # check MySQL dir

+ 4 - 4
include/check_os.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];then
@@ -15,15 +15,15 @@ if [ -n "`grep 'Aliyun Linux release' /etc/issue`" -o -e /etc/redhat-release ];t
     [ -n "`grep ' 5\.' /etc/redhat-release`" -o -n "`grep 'Aliyun Linux release5' /etc/issue`" ] && CentOS_RHEL_version=5
 elif [ -n "`grep bian /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Debian' ];then
     OS=Debian
-    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; }
+    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
     Debian_version=`lsb_release -sr | awk -F. '{print $1}'`
 elif [ -n "`grep Deepin /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Deepin' ];then
     OS=Debian
-    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; }
+    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
     Debian_version=`lsb_release -sr | awk -F. '{print $1}'`
 elif [ -n "`grep Ubuntu /etc/issue`" -o "`lsb_release -is 2>/dev/null`" == 'Ubuntu' ];then
     OS=Ubuntu
-    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; }
+    [ ! -e "`which lsb_release`" ] && { apt-get -y update; apt-get -y install lsb-release; clear; }
     Ubuntu_version=`lsb_release -sr | awk -F. '{print $1}'`
 else
     echo "${CFAILURE}Does not support this OS, Please contact the author! ${CEND}"

+ 1 - 1
include/color.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 echo=echo

+ 1 - 1
include/demo.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 DEMO() {

+ 1 - 1
include/download.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Download_src() {

+ 1 - 1
include/eaccelerator-0.9.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_eAccelerator-0-9() {

+ 1 - 1
include/eaccelerator-1.0-dev.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_eAccelerator-1-0-dev() {

+ 1 - 1
include/get_char.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 get_char() {

+ 3 - 11
include/hhvm_CentOS.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_hhvm_CentOS() {
@@ -15,10 +15,7 @@ id -u $run_user >/dev/null 2>&1
 [ $? -ne 0 ] && useradd -M -s /sbin/nologin $run_user
 
 if [ "$CentOS_RHEL_version" == '7' ];then
-    if [ -e /etc/yum.repos.d/epel.repo_bk ];then
-        /bin/mv /etc/yum.repos.d/epel.repo{_bk,}
-    elif [ ! -e /etc/yum.repos.d/epel.repo ];then
-        cat > /etc/yum.repos.d/epel.repo << EOF
+    [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 7 - \$basearch
 #baseurl=http://download.fedoraproject.org/pub/epel/7/\$basearch
@@ -27,7 +24,6 @@ failovermethod=priority
 enabled=1
 gpgcheck=0
 EOF
-    fi
     cat > /etc/yum.repos.d/hhvm.repo << EOF
 [hhvm]
 name=gleez hhvm-repo
@@ -40,10 +36,7 @@ EOF
 fi
 
 if [ "$CentOS_RHEL_version" == '6' ];then
-    if [ -e /etc/yum.repos.d/epel.repo_bk ];then
-        /bin/mv /etc/yum.repos.d/epel.repo{_bk,}
-    elif [ ! -e /etc/yum.repos.d/epel.repo ];then
-        cat > /etc/yum.repos.d/epel.repo << EOF
+    [ ! -e /etc/yum.repos.d/epel.repo ] && cat > /etc/yum.repos.d/epel.repo << EOF
 [epel]
 name=Extra Packages for Enterprise Linux 6 - \$basearch
 #baseurl=http://download.fedoraproject.org/pub/epel/6/\$basearch
@@ -52,7 +45,6 @@ failovermethod=priority
 enabled=1
 gpgcheck=0
 EOF
-    fi
 
     for Package in libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel libevent-devel libcurl-devel libmemcached-devel lcms2 inotify-tools
     do

+ 6 - 6
include/init_CentOS.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 sed -i 's@^exclude@#exclude@' /etc/yum.conf
@@ -59,11 +59,11 @@ sed -i 's/^id:.*$/id:3:initdefault:/' /etc/inittab
 init q
 
 # PS1
-[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc
+[ -z "`grep ^PS1 ~/.bashrc`" ] && echo 'PS1="\[\e[37;40m\][\[\e[32;40m\]\u\[\e[37;40m\]@\h \[\e[35;40m\]\W\[\e[0m\]]\\$ "' >> ~/.bashrc
 
 # history size
 sed -i 's/^HISTSIZE=.*$/HISTSIZE=100/' /etc/profile
-[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
+[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
 
 # /etc/security/limits.conf
 [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
@@ -90,11 +90,11 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 #EOF
 
 # alias vi
-[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc
+[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@alias mv=\(.*\)@alias mv=\1\nalias vi=vim@" ~/.bashrc && echo 'syntax on' >> /etc/vimrc
 
 # /etc/sysctl.conf
 sed -i 's/net.ipv4.tcp_syncookies.*$/net.ipv4.tcp_syncookies = 1/g' /etc/sysctl.conf
-[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF
+[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF
 fs.file-max=65535
 fs.inotify.max_user_instances = 8192
 net.ipv4.tcp_fin_timeout = 30
@@ -136,7 +136,7 @@ init q
 
 # Update time
 ntpdate pool.ntp.org
-[ -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; }
+[ ! -e "/var/spool/cron/root" -o -z "`grep 'ntpdate' /var/spool/cron/root`" ] && { echo "*/20 * * * * `which ntpdate` pool.ntp.org > /dev/null 2>&1" >> /var/spool/cron/root;chmod 600 /var/spool/cron/root; }
 service crond restart
 
 # iptables

+ 7 - 7
include/init_Debian.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*
@@ -26,11 +26,11 @@ do
 done
 
 # PS1
-[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc
+[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc
 
 # history size
-[ -z "`cat ~/.bashrc | grep ^HISTSIZE`" ] && echo 'HISTSIZE=100' >> ~/.bashrc
-[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
+[ -z "`grep ^HISTSIZE ~/.bashrc`" ] && echo 'HISTSIZE=100' >> ~/.bashrc
+[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
 
 # /etc/security/limits.conf
 [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
@@ -62,13 +62,13 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 #EOF
 
 # alias vi
-[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc
-[ -z "`cat /etc/vim/vimrc | grep 'syntax on'`" ] && echo 'syntax on' >> /etc/vim/vimrc
+[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc
+sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc
 sed -i 's@^# export LS_OPTIONS@export LS_OPTIONS@' ~/.bashrc
 sed -i 's@^# alias@alias@g' ~/.bashrc
 
 # /etc/sysctl.conf
-[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF
+[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF
 fs.file-max=65535
 fs.inotify.max_user_instances = 8192
 net.ipv4.tcp_syncookies = 1

+ 6 - 5
include/init_Ubuntu.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 for Package in apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common libmysqlclient18 php5 php5-common php5-cgi php5-mysql php5-curl php5-gd libmysql* mysql-*
@@ -48,11 +48,11 @@ fi
 #[ "$sendmail_yn" == 'y' ] && apt-get -y install sendmail
 
 # PS1
-[ -z "`cat ~/.bashrc | grep ^PS1`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc
+[ -z "`grep ^PS1 ~/.bashrc`" ] && echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\e[1;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> ~/.bashrc
 
 # history size
 sed -i 's/HISTSIZE=.*$/HISTSIZE=100/g' ~/.bashrc
-[ -z "`cat ~/.bashrc | grep history-timestamp`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
+[ -z "`grep history-timestamp ~/.bashrc`" ] && echo "export PROMPT_COMMAND='{ msg=\$(history 1 | { read x y; echo \$y; });user=\$(whoami); echo \$(date \"+%Y-%m-%d %H:%M:%S\"):\$user:\`pwd\`/:\$msg ---- \$(who am i); } >> /tmp/\`hostname\`.\`whoami\`.history-timestamp'" >> ~/.bashrc
 
 # /etc/security/limits.conf
 [ -e /etc/security/limits.d/*nproc.conf ] && rename nproc.conf nproc.conf_bk /etc/security/limits.d/*nproc.conf
@@ -84,10 +84,11 @@ ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 #EOF
 
 # alias vi
-[ -z "`cat ~/.bashrc | grep 'alias vi='`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc
+[ -z "`grep 'alias vi=' ~/.bashrc`" ] && sed -i "s@^alias l=\(.*\)@alias l=\1\nalias vi='vim'@" ~/.bashrc
+sed -i 's@^"syntax on@syntax on@' /etc/vim/vimrc
 
 # /etc/sysctl.conf
-[ -z "`cat /etc/sysctl.conf | grep 'fs.file-max'`" ] && cat >> /etc/sysctl.conf << EOF
+[ -z "`grep 'fs.file-max' /etc/sysctl.conf`" ] && cat >> /etc/sysctl.conf << EOF
 fs.file-max=65535
 fs.inotify.max_user_instances = 8192
 net.ipv4.tcp_syncookies = 1

+ 1 - 1
include/ioncube.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ionCube() {

+ 1 - 1
include/jdk-1.6.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK-1-6() {

+ 1 - 1
include/jdk-1.7.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK-1-7() {

+ 1 - 1
include/jdk-1.8.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install-JDK-1-8() {

+ 1 - 1
include/jemalloc.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_jemalloc() {

+ 1 - 1
include/mariadb-10.0.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB-10-0() {

+ 1 - 1
include/mariadb-10.1.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB-10-1() {

+ 1 - 1
include/mariadb-5.5.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MariaDB-5-5() {

+ 1 - 1
include/memcached.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_memcached() {

+ 1 - 1
include/memory.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Mem=`free -m | awk '/Mem:/{print $2}'`

+ 1 - 1
include/mysql-5.5.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL-5-5() {

+ 1 - 1
include/mysql-5.6.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL-5-6() {

+ 1 - 1
include/mysql-5.7.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_MySQL-5-7() {

+ 1 - 1
include/nginx.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Nginx() {

+ 1 - 1
include/openresty.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_OpenResty() {

+ 1 - 1
include/percona-5.5.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona-5-5() {

+ 1 - 1
include/percona-5.6.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona-5-6() {

+ 1 - 1
include/percona-5.7.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Percona-5-7() {

+ 1 - 1
include/php-5.3.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP-5-3() {

+ 1 - 1
include/php-5.4.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP-5-4() {

+ 1 - 1
include/php-5.5.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP-5-5() {

+ 1 - 1
include/php-5.6.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP-5-6() {

+ 1 - 1
include/php-7.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PHP-7() {

+ 1 - 1
include/phpmyadmin.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_phpMyAdmin() {

+ 1 - 1
include/pureftpd.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_PureFTPd() {

+ 1 - 1
include/redis.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_redis-server() {

+ 1 - 1
include/tcmalloc.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_tcmalloc() {

+ 1 - 1
include/tengine.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_Tengine() {

+ 1 - 1
include/tomcat-6.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_tomcat-6() {

+ 1 - 1
include/tomcat-7.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_tomcat-7() {

+ 1 - 1
include/tomcat-8.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_tomcat-8() {

+ 1 - 1
include/upgrade_db.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Upgrade_DB() {

+ 1 - 1
include/upgrade_php.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Upgrade_PHP() {

+ 1 - 1
include/upgrade_phpmyadmin.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Upgrade_phpMyAdmin() {

+ 1 - 1
include/upgrade_redis.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Upgrade_Redis() {

+ 1 - 1
include/upgrade_web.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Upgrade_Nginx() {

+ 1 - 1
include/xcache.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_XCache()

+ 1 - 1
include/zendopcache.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 Install_ZendOPcache()

+ 2 - 2
install.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -13,7 +13,7 @@ clear
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 

+ 2 - 2
pureftpd_vhost.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #                 FTP virtual user account management                 #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 

+ 2 - 2
reset_db_root_password.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #              Reset Database root password for OneinStack            #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 

+ 4 - 4
shadowsocks.sh

@@ -6,7 +6,7 @@
 #        Install Shadowsocks Server
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -15,7 +15,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 6+ Debian 6+ and Ubuntu 12+      #
 #                   Install Shadowsocks Server                        #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 
@@ -137,7 +137,7 @@ if [ -f /usr/bin/pip ]; then
         [ ! -e /usr/bin/ssserver -a -e /usr/local/bin/ssserver ] && sed -i 's@Shadowsocks_bin=.*@Shadowsocks_bin=/usr/local/bin/ssserver@' /etc/init.d/shadowsocks
     else
         echo
-        echo "${CQUESTION}Shadowsocks-python install failed! Please visit http://oneinstack.com${CEND}"
+        echo "${CQUESTION}Shadowsocks-python install failed! Please visit https://oneinstack.com${CEND}"
         exit 1
     fi
 fi
@@ -155,7 +155,7 @@ if [ -f  /usr/local/bin/ss-server ];then
     [ "$OS" == 'CentOS' ] && { chkconfig --add shadowsocks; chkconfig shadowsocks on; }
 else
    echo
-   echo "${CQUESTION}Shadowsocks-libev install failed! Please visit http://oneinstack.com${CEND}"
+   echo "${CQUESTION}Shadowsocks-libev install failed! Please visit https://oneinstack.com${CEND}"
    exit 1
 fi
 

+ 1 - 1
tools/db_bk.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 . ../options.conf

+ 1 - 1
tools/website_bk.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 . ../options.conf

+ 2 - 2
uninstall.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #                         Uninstall OneinStack                        #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 

+ 2 - 2
upgrade.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -14,7 +14,7 @@ printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
 #       upgrade Web,Database,PHP,Redis,phpMyAdmin for OneinStack      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 # get pwd

+ 86 - 26
vhost.sh

@@ -5,7 +5,7 @@
 # Notes: OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+
 #
 # Project home page:
-#       http://oneinstack.com
+#       https://oneinstack.com
 #       https://github.com/lj2007331/oneinstack
 
 export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
@@ -13,13 +13,14 @@ clear
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 
 . ./options.conf
 . ./include/color.sh
 . ./include/check_dir.sh
+. ./include/check_os.sh
 . ./include/get_char.sh
 
 # Check if user is root
@@ -124,7 +125,7 @@ elif [ "$NGX_FLAG" == 'hhvm' ];then
 fi
 }
 
-Create_SSL() {
+Create_self_SSL() {
 printf "
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
@@ -154,23 +155,80 @@ echo
 read -p "Organizational Unit Name (eg, section) [IT Dept.]: " SELFSIGNEDSSL_OU
 [ -z "$SELFSIGNEDSSL_OU" ] && SELFSIGNEDSSL_OU='IT Dept.'
 
-if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then
-  LISTENOPT='443 ssl http2'
-else
-  LISTENOPT='443 ssl spdy'
-fi
-
-[ ! -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
 }
 
+Create_SSL() {
+if [ -e "/usr/local/bin/certbot-auto" ];then
+    while :; do echo
+        read -p "Do you want to use a Let's Encrypt certificate? [y/n]: " letsencrypt_yn 
+        if [[ ! $letsencrypt_yn =~ ^[y,n]$ ]];then
+            echo "${CWARNING}input error! Please only input 'y' or 'n'${CEND}"
+        else
+            break
+        fi
+    done
+    if [ "$letsencrypt_yn" == 'y' ];then
+        PUBLIC_IPADDR=`./include/get_public_ipaddr.py`
+        for D in $domain $moredomainame
+        do
+            Domain_IPADDR=`ping $D -c1 | sed '1{s/[^(]*(//;s/).*//;q}'`
+            [ "$PUBLIC_IPADDR" != "$Domain_IPADDR" ] && { echo; echo "${CFAILURE}DNS problem: NXDOMAIN looking up A for $D${CEND}"; echo; exit 1; }
+        done
+
+        #add Email
+        while :
+        do
+            echo
+            read -p "Please enter Administrator Email(example: admin@linuxeye.com): " Admin_Email
+            if [ -z "`echo $Admin_Email | grep '.*@.*\..*'`" ]; then
+                echo "${CWARNING}input error! ${CEND}"
+            else
+                break
+            fi
+        done
+        [ "$moredomainame_yn" == 'y' ] && moredomainame_D="`for D in $moredomainame; do echo -d $D; done`"
+        [ "$nginx_ssl_yn" == 'y' ] && S=nginx
+        [ "$apache_ssl_yn" == 'y' ] && S=httpd
+        [ ! -d "$vhostdir/.well-known" ] && mkdir -p $vhostdir/.well-known;chown -R $run_user.$run_user $vhostdir/.well-known 
+        certbot-auto certonly --standalone --agree-tos --email $Admin_Email -d $domain $moredomainame_D --pre-hook "service $S stop" --post-hook "service $S start"
+        if [ -s "/etc/letsencrypt/live/$domain/cert.pem" ];then
+            [ -e "$PATH_SSL/$domain.crt" ] && rm -rf $PATH_SSL/$domain.{crt,key}
+            ln -s /etc/letsencrypt/live/$domain/fullchain.pem $PATH_SSL/$domain.crt
+            ln -s /etc/letsencrypt/live/$domain/privkey.pem $PATH_SSL/$domain.key
+            if [ -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then 
+                Cron_Command='/etc/init.d/nginx reload;/etc/init.d/httpd graceful'
+            elif [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then 
+                Cron_Command='/etc/init.d/nginx reload'
+            elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/conf/httpd.conf" ];then 
+                Cron_Command='/etc/init.d/httpd graceful'
+            fi
+            [ "$OS" == 'CentOS' ] && Cron_file=/var/spool/cron/root || Cron_file=/var/spool/cron/crontabs/root
+            [ -z "`grep \'$domain $moredomainame_D\' $Cron_file`" ] && echo "0 10 * * 1 /usr/local/bin/certbot-auto certonly -a webroot --agree-tos --renew-by-default --webroot-path=$wwwroot_dir/$domain -d $domain $moredomainame_D;$Cron_Command" >> $Cron_file
+        else
+            echo "${CFAILURE}Error: Let's Encrypt SSL certificate installation failed${CEND}"
+            exit 1
+        fi
+    else
+        Create_self_SSL
+    fi
+else
+    Create_self_SSL
+fi
+}
+
 Print_ssl() {
-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}"
+if [ "$letsencrypt_yn" == 'y' ];then
+    echo "`printf "%-30s" "Let's Encrypt SSL Certificate:"`${CMSG}/etc/letsencrypt/live/$domain/fullchain.pem${CEND}"
+    echo "`printf "%-30s" "SSL Private Key:"`${CMSG}/etc/letsencrypt/live/$domain/privkey.pem${CEND}"
+else
+    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}"
+fi
 }
 
 
@@ -195,8 +253,8 @@ elif [ ! -e "$web_install_dir/sbin/nginx" -a -e "$apache_install_dir/bin/apachec
     done
 fi
 
-[ "$apache_ssl_yn" == 'y' ] && PATH_SSL=$apache_install_dir/conf/ssl
-[ "$nginx_ssl_yn" == 'y' ] && PATH_SSL=$web_install_dir/conf/ssl
+[ "$apache_ssl_yn" == 'y' ] && { PATH_SSL=$apache_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; }
+[ "$nginx_ssl_yn" == 'y' ] && { PATH_SSL=$web_install_dir/conf/ssl; [ ! -d "$PATH_SSL" ] && mkdir $PATH_SSL; }
 
 while :; do echo
     read -p "Please input domain(example: www.linuxeye.com): " domain
@@ -249,12 +307,16 @@ if [ "$moredomainame_yn" == 'y' ]; then
                 break
             fi
         done
-        [ "$nginx_ssl_yn" == 'y' ] && HTTP_flag=https || HTTP_flag=http
         [ "$redirect_yn" == 'y' ] && Nginx_redirect=$(echo -e "if (\$host != $domain) {\n    rewrite ^/(.*)\$ \$scheme://$domain/\$1 permanent;\n    }")
     fi
 fi
 
 if [ "$nginx_ssl_yn" == 'y' ]; then
+    if [[ "$($web_install_dir/sbin/nginx -V 2>&1 | grep -Eo 'with-http_v2_module')" = 'with-http_v2_module' ]]; then
+      LISTENOPT='443 ssl http2'
+    else
+      LISTENOPT='443 ssl spdy'
+    fi
     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\"")
@@ -417,7 +479,7 @@ fi
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}"
@@ -444,7 +506,7 @@ echo
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}"
@@ -492,7 +554,7 @@ fi
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}"
@@ -577,7 +639,7 @@ fi
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}"
@@ -586,7 +648,7 @@ echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}"
 }
 
 Create_nginx_apache_mod-php_conf() {
-# Nginx/Tengine
+# Nginx/Tengine/OpenResty
 [ ! -d $web_install_dir/conf/vhost ] && mkdir $web_install_dir/conf/vhost
 cat > $web_install_dir/conf/vhost/$domain.conf << EOF
 server {
@@ -667,7 +729,7 @@ fi
 printf "
 #######################################################################
 #       OneinStack for CentOS/RadHat 5+ Debian 6+ and Ubuntu 12+      #
-#       For more information please visit http://oneinstack.com       #
+#       For more information please visit https://oneinstack.com      #
 #######################################################################
 "
 echo "`printf "%-30s" "Your domain:"`${CMSG}$domain${CEND}"
@@ -679,7 +741,7 @@ echo "`printf "%-30s" "Directory of:"`${CMSG}$vhostdir${CEND}"
 }
 
 Add_Vhost() {
-    if [ -e "$web_install_dir/sbin/nginx" -a ! -e "`ls $apache_install_dir/modules/libphp?.so 2>/dev/null`" ];then
+    if [ -e "$web_install_dir/sbin/nginx" -a ! -e "$apache_install_dir/conf/httpd.conf" ];then
         Choose_env
         Input_Add_domain
         Nginx_anti_hotlinking
@@ -691,7 +753,7 @@ Add_Vhost() {
             Nginx_log
             Create_nginx_php-fpm_hhvm_conf
         fi
-    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
         Apache_log
@@ -871,13 +933,11 @@ elif [ $# == 1 ];then
     add)
         Add_Vhost
         ;;
-
     del)
         Del_NGX_Vhost
         Del_Apache_Vhost
         Del_Tomcat_Vhost
         ;;
-
     *)
         Usage
         ;;