Selaa lähdekoodia

Fix web server detection in forcessl

Robert Zollner 6 vuotta sitten
vanhempi
sitoutus
0824701f51
2 muutettua tiedostoa jossa 8 lisäystä ja 4 poistoa
  1. 2 2
      bin/v-add-web-domain-ssl-force
  2. 6 2
      bin/v-delete-web-domain-ssl-force

+ 2 - 2
bin/v-add-web-domain-ssl-force

@@ -43,7 +43,7 @@ if [ "$SSL" != 'yes' ]; then
 fi
 fi
 
 
 # Check if proxy is active
 # Check if proxy is active
-if [ ! -z "$PROXY_SYSTEM" ] || [ ! -z "$PROXY" ]; then
+if [ ! -z "$PROXY_SYSTEM" ]; then
     if ! grep --quiet "forcessl" $HESTIA/data/templates/web/nginx/default.tpl; then
     if ! grep --quiet "forcessl" $HESTIA/data/templates/web/nginx/default.tpl; then
         $BIN/v-update-web-templates
         $BIN/v-update-web-templates
     fi
     fi
@@ -56,7 +56,7 @@ else
 fi
 fi
 
 
 # Insert redirect commands
 # Insert redirect commands
-if [ ! -z $PROXY ]; then
+if [ ! -z "$PROXY_SYSTEM" ] || [ "$WEB_SYSTEM" = 'nginx' ]; then
     echo 'return 301 https://$host$request_uri;' > $forcessl
     echo 'return 301 https://$host$request_uri;' > $forcessl
 else
 else
     echo 'RewriteEngine On' > $forcessl
     echo 'RewriteEngine On' > $forcessl

+ 6 - 2
bin/v-delete-web-domain-ssl-force

@@ -38,8 +38,12 @@ is_object_valid 'web' 'DOMAIN' "$domain" "$FORCESSL"
 eval $(grep "DOMAIN='$domain'" $USER_DATA/web.conf)
 eval $(grep "DOMAIN='$domain'" $USER_DATA/web.conf)
 
 
 # Remove forcessl configs
 # Remove forcessl configs
-rm -f $HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.forcessl.conf
-rm -f $HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.forcessl.conf
+if [ -f $HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.forcessl.conf ]; then
+    rm -f $HOMEDIR/$user/conf/web/$domain/$WEB_SYSTEM.forcessl.conf
+fi
+if [ -f $HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.forcessl.conf ]; then
+    rm -f $HOMEDIR/$user/conf/web/$domain/$PROXY_SYSTEM.forcessl.conf
+fi
 
 
 #----------------------------------------------------------#
 #----------------------------------------------------------#
 #                       Hestia                             #
 #                       Hestia                             #