Skip to content

Commit 21a2ead

Browse files
authored
Fix Nginx web statistics authorization (hestiacp#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`
1 parent 67acac3 commit 21a2ead

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

bin/v-add-web-domain-stats

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# info: add log analyzer to generate domain statitics
2+
# info: add log analyzer to generate domain statistics
33
# options: USER DOMAIN TYPE
44
# labels: web
55
#

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ conf_dir="$HOMEDIR/$user/conf/web"
5252

5353
# Adding htaccess file
5454
if [ "$WEB_SYSTEM" = 'nginx' ]; then
55-
echo "auth_basic \"Web Statistics\";" > $conf_dir/$domain.auth
56-
echo "auth_basic_user_file $stats_dir/.htpasswd;" >> $conf_dir/$domain.auth
55+
echo "auth_basic \"Web Statistics\";" > $stats_dir/auth.conf
56+
echo "auth_basic_user_file $stats_dir/.htpasswd;" >> $stats_dir/auth.conf
5757
else
5858
echo "AuthUserFile $stats_dir/.htpasswd" > $stats_dir/.htaccess
5959
echo "AuthName \"Web Statistics\"" >> $stats_dir/.htaccess

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# info: disable webdomain stats authentication support
2+
# info: disable web domain stats authentication support
33
# options: USER DOMAIN [RESTART]
44
# labels: web
55
#
@@ -47,14 +47,14 @@ check_hestia_demo_mode
4747
# Action #
4848
#----------------------------------------------------------#
4949

50-
# Defining statistic dir
51-
rm -f $HOMEDIR/$user/web/$domain/stats/.htpasswd
52-
rm -f $HOMEDIR/$user/web/$domain/stats/.htaccess
50+
# Deleting statistic dir
51+
stats_dir="$HOMEDIR/$user/web/$domain/stats"
52+
rm -f $stats_dir/.htpasswd
53+
rm -f $stats_dir/.htaccess
5354

5455
# Deleting nginx auth config
5556
if [ "$WEB_SYSTEM" = 'nginx' ]; then
56-
conf_dir="$HOMEDIR/$user/conf/web"
57-
rm -f $conf_dir/$domain.auth 2>/dev/null
57+
rm -f $stats_dir/auth.conf 2>/dev/null
5858
$BIN/v-restart-web $restart
5959
check_result $? "Web restart failed" >/dev/null
6060
fi

0 commit comments

Comments
 (0)