浏览代码

Update vhost.sh

lj2007331 8 年之前
父节点
当前提交
fdd35a2f23
共有 5 个文件被更改,包括 108 次插入12 次删除
  1. 1 1
      include/init_Debian.sh
  2. 1 1
      include/init_Ubuntu.sh
  3. 1 1
      install.sh
  4. 1 1
      versions.txt
  5. 104 8
      vhost.sh

+ 1 - 1
include/init_Debian.sh

@@ -20,7 +20,7 @@ apt-get -y update
 [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade
 
 # Install needed packages
-for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc
+for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libjpeg-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales libcloog-ppl0 patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz cron logrotate ntpdate psmisc
 do
     apt-get -y install $Package
 done

+ 1 - 1
include/init_Ubuntu.sh

@@ -20,7 +20,7 @@ apt-get -y update
 [ "$upgrade_yn" == 'y' ] && apt-get -y upgrade
 
 # Install needed packages
-for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop wget bc expect rsync git lsof lrzsz ntpdate
+for Package in gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libpng3 libfreetype6 libfreetype6-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev libreadline-dev curl libcurl3 libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev patch vim zip unzip tmux htop bc expect rsync git lsof lrzsz ntpdate
 do
     apt-get -y install $Package
 done

+ 1 - 1
install.sh

@@ -439,7 +439,7 @@ while :; do echo
     else
         if [ "$HHVM_yn" == 'y' ];then
             [ -e "/usr/bin/hhvm" ] && { echo "${CWARNING}HHVM already installed! ${CEND}"; HHVM_yn=Other; break; }
-            if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.5| 6\.6| 6\.7' /etc/redhat-release`" ];then
+            if [ "$OS" == 'CentOS' -a "$OS_BIT" == '64' ] && [ -n "`grep -E ' 7\.| 6\.[5-9]' /etc/redhat-release`" ];then
                 break
             else
                 echo

+ 1 - 1
versions.txt

@@ -43,7 +43,7 @@ php_3_version=5.3.29
 zendopcache_version=7.0.5
 xcache_version=3.2.0
 apcu_version=4.0.10
-ImageMagick_version=6.9.5-0
+ImageMagick_version=6.9.5-2
 imagick_version=3.4.1
 GraphicsMagick_version=1.3.24
 gmagick_version=1.1.7RC3

+ 104 - 8
vhost.sh

@@ -320,11 +320,6 @@ if [ "$nginx_ssl_yn" == 'y' ]; then
     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\"")
@@ -451,9 +446,39 @@ location ~ .*\.(js|css)?$ {
     }
 $NGX_CONF
 }
-$Nginx_http_to_https
 EOF
 
+if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+rewrite ^/(.*) https://$domain/\$1 permanent;
+}
+EOF
+elif [ "$nginx_ssl_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+$N_log
+index index.html index.htm index.jsp;
+root $vhostdir;
+$Nginx_redirect
+$anti_hotlinking
+location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
+    expires 30d;
+    access_log off;
+    }
+location ~ .*\.(js|css)?$ {
+    expires 7d;
+    access_log off;
+    }
+$NGX_CONF
+}
+EOF
+fi
+
 cat > $tomcat_install_dir/conf/vhost/$domain.xml << EOF
 <Host name="$domain" appBase="webapps" unpackWARs="true" autoDeploy="true"> $Tomcat_Domain_alias
   <Context path="" docBase="$vhostdir" debug="0" reloadable="false" crossContext="true"/>
@@ -537,9 +562,40 @@ location ~ .*\.(js|css)?$ {
     access_log off;
     }
 }
-$Nginx_http_to_https
 EOF
 
+if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+rewrite ^/(.*) https://$domain/\$1 permanent;
+}
+EOF
+elif [ "$nginx_ssl_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+$N_log
+index index.html index.htm index.php;
+include $web_install_dir/conf/rewrite/$rewrite.conf;
+root $vhostdir;
+$Nginx_redirect
+$anti_hotlinking
+$NGX_CONF
+location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
+    expires 30d;
+    access_log off;
+    }
+location ~ .*\.(js|css)?$ {
+    expires 7d;
+    access_log off;
+    }
+}
+EOF
+fi
+
 echo
 $web_install_dir/sbin/nginx -t
 if [ $? == 0 ];then
@@ -679,9 +735,49 @@ location ~ .*\.(js|css)?$ {
     access_log off;
     }
 }
-$Nginx_http_to_https
 EOF
 
+if [ "$nginx_ssl_yn" == 'y' -a "$redirect_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+rewrite ^/(.*) https://$domain/\$1 permanent;
+}
+EOF
+elif [ "$nginx_ssl_yn" == 'y' ];then
+cat >> $web_install_dir/conf/vhost/$domain.conf << EOF
+server {
+listen 80;
+server_name $domain$moredomainame;
+$N_log
+index index.html index.htm index.php;
+root $vhostdir;
+$Nginx_redirect
+$anti_hotlinking
+location / {
+    try_files \$uri @apache;
+    }
+location @apache {
+    proxy_pass http://127.0.0.1:88;
+    include proxy.conf;
+    }
+location ~ .*\.(php|php5|cgi|pl)?$ {
+    proxy_pass http://127.0.0.1:88;
+    include proxy.conf;
+    }
+location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
+    expires 30d;
+    access_log off;
+    }
+location ~ .*\.(js|css)?$ {
+    expires 7d;
+    access_log off;
+    }
+}
+EOF
+fi
+
 echo
 $web_install_dir/sbin/nginx -t
 if [ $? == 0 ];then