فهرست منبع

Fix Nginx web statistics authorization (#1508)

* Fix typos in domain stats scripts

* Update auth config path for stats

All nginx templates expect stats auth.conf to be in
`%home%/%user%/web/%domain%/stats/auth.conf`
Stanislav Petrashov 5 سال پیش
والد
کامیت
21a2eadef6
3فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 1 1
      bin/v-add-web-domain-stats
  2. 2 2
      bin/v-add-web-domain-stats-user
  3. 6 6
      bin/v-delete-web-domain-stats-user

+ 1 - 1
bin/v-add-web-domain-stats

@@ -1,5 +1,5 @@
 #!/bin/bash
-# info: add log analyzer to generate domain statitics
+# info: add log analyzer to generate domain statistics
 # options: USER DOMAIN TYPE
 # labels: web
 #

+ 2 - 2
bin/v-add-web-domain-stats-user

@@ -52,8 +52,8 @@ conf_dir="$HOMEDIR/$user/conf/web"
 
 # Adding htaccess file
 if [ "$WEB_SYSTEM" = 'nginx' ]; then
-    echo "auth_basic \"Web Statistics\";" > $conf_dir/$domain.auth
-    echo "auth_basic_user_file $stats_dir/.htpasswd;" >> $conf_dir/$domain.auth
+    echo "auth_basic \"Web Statistics\";" > $stats_dir/auth.conf
+    echo "auth_basic_user_file $stats_dir/.htpasswd;" >> $stats_dir/auth.conf
 else
     echo "AuthUserFile $stats_dir/.htpasswd" > $stats_dir/.htaccess
     echo "AuthName \"Web Statistics\"" >> $stats_dir/.htaccess

+ 6 - 6
bin/v-delete-web-domain-stats-user

@@ -1,5 +1,5 @@
 #!/bin/bash
-# info: disable webdomain stats  authentication support
+# info: disable web domain stats authentication support
 # options: USER DOMAIN [RESTART]
 # labels: web
 #
@@ -47,14 +47,14 @@ check_hestia_demo_mode
 #                       Action                             #
 #----------------------------------------------------------#
 
-# Defining statistic dir
-rm -f $HOMEDIR/$user/web/$domain/stats/.htpasswd
-rm -f $HOMEDIR/$user/web/$domain/stats/.htaccess
+# Deleting statistic dir
+stats_dir="$HOMEDIR/$user/web/$domain/stats"
+rm -f $stats_dir/.htpasswd
+rm -f $stats_dir/.htaccess
 
 # Deleting nginx auth config
 if [ "$WEB_SYSTEM" = 'nginx' ]; then
-    conf_dir="$HOMEDIR/$user/conf/web"
-    rm -f $conf_dir/$domain.auth 2>/dev/null
+    rm -f $stats_dir/auth.conf 2>/dev/null
     $BIN/v-restart-web $restart
     check_result $? "Web restart failed" >/dev/null
 fi