Browse Source

Merge remote-tracking branch 'origin/main' into feature/osal

Ernesto Nicolás Carrea 5 years ago
parent
commit
6ca4c04413
100 changed files with 1370 additions and 821 deletions
  1. 25 0
      CHANGELOG.md
  2. 2 0
      README.md
  3. 1 7
      bin/v-add-cron-hestia-autoupdate
  4. 18 8
      bin/v-add-database-host
  5. 5 0
      bin/v-add-mail-domain
  6. 7 2
      bin/v-add-sys-webmail
  7. 8 9
      bin/v-add-user
  8. 0 125
      bin/v-add-user-favourites
  9. 11 10
      bin/v-change-user-name
  10. 1 0
      bin/v-delete-cron-hestia-autoupdate
  11. 7 3
      bin/v-delete-sys-webmail
  12. 0 128
      bin/v-delete-user-favourites
  13. 6 4
      bin/v-download-backup
  14. 8 3
      bin/v-list-database-host
  15. 16 7
      bin/v-list-database-hosts
  16. 5 6
      bin/v-list-user
  17. 0 117
      bin/v-list-user-favourites
  18. 4 5
      bin/v-list-users
  19. 62 0
      bin/v-rebuild-all
  20. 2 2
      bin/v-rebuild-mail-domain
  21. 2 2
      bin/v-rebuild-mail-domains
  22. 34 3
      func/db.sh
  23. 3 1
      func/ip.sh
  24. 1 2
      func/main.sh
  25. 8 1
      func/rebuild.sh
  26. 119 22
      func/upgrade.sh
  27. 1 1
      install/deb/apache2/apache2.conf
  28. 1 1
      install/deb/filemanager/filegator/backend/Services/Auth/Adapters/HestiaAuth.php
  29. 2 2
      install/deb/nginx/phpmyadmin.inc
  30. 1 1
      install/deb/nginx/phppgadmin.inc
  31. 5 0
      install/deb/templates/web/apache2/default.stpl
  32. 5 0
      install/deb/templates/web/apache2/default.tpl
  33. 5 0
      install/deb/templates/web/apache2/hosting.stpl
  34. 5 0
      install/deb/templates/web/apache2/hosting.tpl
  35. 5 0
      install/deb/templates/web/apache2/php-fpm/default.stpl
  36. 5 0
      install/deb/templates/web/apache2/php-fpm/default.tpl
  37. 5 0
      install/deb/templates/web/apache2/phpcgi.stpl
  38. 5 0
      install/deb/templates/web/apache2/phpcgi.tpl
  39. 5 0
      install/deb/templates/web/apache2/phpfcgid.stpl
  40. 5 0
      install/deb/templates/web/apache2/phpfcgid.tpl
  41. 5 0
      install/deb/templates/web/nginx/caching.stpl
  42. 5 0
      install/deb/templates/web/nginx/caching.tpl
  43. 5 0
      install/deb/templates/web/nginx/default.stpl
  44. 5 0
      install/deb/templates/web/nginx/default.tpl
  45. 5 0
      install/deb/templates/web/nginx/hosting.stpl
  46. 5 0
      install/deb/templates/web/nginx/hosting.tpl
  47. 5 0
      install/deb/templates/web/nginx/php-fpm/cms_made_simple.stpl
  48. 5 0
      install/deb/templates/web/nginx/php-fpm/cms_made_simple.tpl
  49. 5 0
      install/deb/templates/web/nginx/php-fpm/codeigniter2.stpl
  50. 5 0
      install/deb/templates/web/nginx/php-fpm/codeigniter2.tpl
  51. 5 0
      install/deb/templates/web/nginx/php-fpm/codeigniter3.stpl
  52. 5 0
      install/deb/templates/web/nginx/php-fpm/codeigniter3.tpl
  53. 5 0
      install/deb/templates/web/nginx/php-fpm/datalife_engine.stpl
  54. 5 0
      install/deb/templates/web/nginx/php-fpm/datalife_engine.tpl
  55. 5 0
      install/deb/templates/web/nginx/php-fpm/default.stpl
  56. 5 0
      install/deb/templates/web/nginx/php-fpm/default.tpl
  57. 5 0
      install/deb/templates/web/nginx/php-fpm/dokuwiki.stpl
  58. 5 0
      install/deb/templates/web/nginx/php-fpm/dokuwiki.tpl
  59. 90 0
      install/deb/templates/web/nginx/php-fpm/drupal-composer.stpl
  60. 86 0
      install/deb/templates/web/nginx/php-fpm/drupal-composer.tpl
  61. 90 0
      install/deb/templates/web/nginx/php-fpm/drupal-social.stpl
  62. 86 0
      install/deb/templates/web/nginx/php-fpm/drupal-social.tpl
  63. 5 0
      install/deb/templates/web/nginx/php-fpm/drupal6.stpl
  64. 5 0
      install/deb/templates/web/nginx/php-fpm/drupal6.tpl
  65. 43 30
      install/deb/templates/web/nginx/php-fpm/drupal7.stpl
  66. 43 30
      install/deb/templates/web/nginx/php-fpm/drupal7.tpl
  67. 43 30
      install/deb/templates/web/nginx/php-fpm/drupal8.stpl
  68. 45 31
      install/deb/templates/web/nginx/php-fpm/drupal8.tpl
  69. 5 0
      install/deb/templates/web/nginx/php-fpm/joomla.stpl
  70. 5 0
      install/deb/templates/web/nginx/php-fpm/joomla.tpl
  71. 5 0
      install/deb/templates/web/nginx/php-fpm/laravel.stpl
  72. 5 0
      install/deb/templates/web/nginx/php-fpm/laravel.tpl
  73. 5 0
      install/deb/templates/web/nginx/php-fpm/magento.stpl
  74. 5 0
      install/deb/templates/web/nginx/php-fpm/magento.tpl
  75. 5 0
      install/deb/templates/web/nginx/php-fpm/modx.stpl
  76. 5 0
      install/deb/templates/web/nginx/php-fpm/modx.tpl
  77. 5 0
      install/deb/templates/web/nginx/php-fpm/moodle.stpl
  78. 5 0
      install/deb/templates/web/nginx/php-fpm/moodle.tpl
  79. 5 0
      install/deb/templates/web/nginx/php-fpm/no-php.stpl
  80. 5 0
      install/deb/templates/web/nginx/php-fpm/no-php.tpl
  81. 5 0
      install/deb/templates/web/nginx/php-fpm/odoo.stpl
  82. 5 0
      install/deb/templates/web/nginx/php-fpm/odoo.tpl
  83. 5 0
      install/deb/templates/web/nginx/php-fpm/opencart.stpl
  84. 5 0
      install/deb/templates/web/nginx/php-fpm/opencart.tpl
  85. 5 0
      install/deb/templates/web/nginx/php-fpm/owncloud.stpl
  86. 5 0
      install/deb/templates/web/nginx/php-fpm/owncloud.tpl
  87. 5 0
      install/deb/templates/web/nginx/php-fpm/piwik.stpl
  88. 5 0
      install/deb/templates/web/nginx/php-fpm/piwik.tpl
  89. 5 0
      install/deb/templates/web/nginx/php-fpm/pyrocms.stpl
  90. 5 0
      install/deb/templates/web/nginx/php-fpm/pyrocms.tpl
  91. 5 0
      install/deb/templates/web/nginx/php-fpm/sendy.stpl
  92. 5 0
      install/deb/templates/web/nginx/php-fpm/sendy.tpl
  93. 90 0
      install/deb/templates/web/nginx/php-fpm/thunder.stpl
  94. 86 0
      install/deb/templates/web/nginx/php-fpm/thunder.tpl
  95. 5 0
      install/deb/templates/web/nginx/php-fpm/wordpress.stpl
  96. 5 0
      install/deb/templates/web/nginx/php-fpm/wordpress.tpl
  97. 5 0
      install/deb/templates/web/nginx/proxy_ip.tpl
  98. 7 15
      install/hst-install-debian.sh
  99. 6 14
      install/hst-install-ubuntu.sh
  100. 10 199
      install/upgrade/versions/latest.sh

+ 25 - 0
CHANGELOG.md

@@ -2,6 +2,31 @@
 All notable changes to this project will be documented in this file.
 
 ## [CURRENT] - Development
+### Features
+
+### Bugfixes
+- Create mailhelo.conf if it doesnt exist to prevent a error message during grep.
+ 
+## [1.2.1] - Service Release 1 (beta)
+### Features
+- Consolidated First and Last Name fields to a singular name field to simply input.
+    - v-change-user-name will now accept both "First Last" (single argument) and First Last (two arguments) for backward compatibility.
+- Removed ntpdate from new installations and enable systemd timesync daemon instead (thanks **@braewoods**)
+
+### Bugfixes
+- Fixed an issue where Composer would fail to install due to missing default directory.
+- Corrected an issue where two-factor authentication validation was causing high CPU load during the login process. The login screen has been re-designed as a multi-step process (Username > Password > OTP PIN).
+- Corrected an issue where text entry fields on the login screen were not automatically focused by default.
+- Fixed an issue where RDNS value was incorrectly set if dig failed to resolve the server name.
+- Fixed an issue where icons were pushed down in the header when using Bulgarian as the display language. (#932)
+- Fixed an issue where new backups were not created when running v-schedule-user-backup-download. (#918)
+- Fixed an issue where default configuration files and templates were not backed up correctly.
+- Improved quality of default web domain templates for Drupal. (#916)
+- Added missing strings to translation files (translations to follow).
+- Corrected an issue where toolbars were out of place on the Mail and Firewall pages when using Bulgarian or Greek languages due to string length.
+- Improved Spanish translations (thanks **@Wibol**)
+- Improved German translations (thanks **@ronald-at**)
+- Improved Russian translations (thanks **@Pleskan**)
 
 ## [1.2.0] - Major Release (Feature / Quality Update)
 ### Features

+ 2 - 0
README.md

@@ -3,6 +3,8 @@
 [Hestia Control Panel](https://www.hestiacp.com/)
 ==================================================
 **Latest stable release:** Version 1.2.0 | [View Changelog](https://github.com/hestiacp/hestiacp/blob/release/CHANGELOG.md)<br>
+**Latest beta release:** Version 1.2.1 | [View Changelog](https://github.com/hestiacp/hestiacp/blob/beta/CHANGELOG.md)<br>
+**Latest unstable development snapshot:** Version 1.2.2 | [View Changelog](https://github.com/hestiacp/hestiacp/blob/main/CHANGELOG.md)<br>
 
 **Web:** [www.hestiacp.com](https://www.hestiacp.com/)<br>
 **Documentation:** [docs.hestiacp.com](https://docs.hestiacp.com/)<br>

+ 1 - 7
bin/v-add-cron-hestia-autoupdate

@@ -44,9 +44,6 @@ time_n_date=$(date +'%T %F')
 time=$(echo "$time_n_date" |cut -f 1 -d \ )
 date=$(echo "$time_n_date" |cut -f 2 -d \ )
 
-# Remove existing cron job
-$BIN/v-delete-cron-hestia-autoupdate
-
 # Define time somewhere at night
 if [ -z "$mode" ] || [ "$mode" = "apt" ]; then
     min=$(generate_password '012345' '2')
@@ -82,9 +79,6 @@ sort_cron_jobs
 # Sync cronjobs with system crond
 sync_cron_jobs
 
-# Perform verification if read-only mode is enabled
-check_hestia_demo_mode
-
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#
@@ -97,7 +91,7 @@ $BIN/v-restart-cron
 check_result $? "Cron restart failed" >/dev/null
 
 # Logging
-log_history "added cron job $job"
+log_history "enabled automatic updates"
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 18 - 8
bin/v-add-database-host

@@ -18,9 +18,10 @@ type=$1
 host=$2
 dbuser=$3
 password=$4; HIDE=4
-max_db=${6-500}
-charsets=${7-UTF8,LATIN1,WIN1250,WIN1251,WIN1252,WIN1256,WIN1258,KOI8}
-template=${8-template1}
+max_db=${5-500}
+charsets=${6}
+template=${7}
+port=${8}
 
 # Includes
 source $HESTIA/func/main.sh
@@ -33,6 +34,8 @@ is_mysql_host_alive() {
     echo "host='$HOST'" >> $mycnf
     echo "user='$USER'" >> $mycnf
     echo "password='$PASSWORD'" >> $mycnf
+    echo "port='$PORT'" >> $mycnf
+    
     chmod 600 $mycnf
     mysql --defaults-file=$mycnf -e 'SELECT VERSION()' >/dev/null 2>&1
     rm $mycnf
@@ -45,7 +48,7 @@ is_mysql_host_alive() {
 
 is_pgsql_host_alive() {
     export PGPASSWORD="$dbpass"
-    psql -h $host -U $dbuser -c "SELECT VERSION()" > /dev/null 2>&1
+    psql -h $host -U $dbuser -p $port -c "SELECT VERSION()" > /dev/null 2>&1
     if [ '0' -ne "$?" ]; then
         echo "Error: PostgreSQL connection to $host failed"
         log_event "$E_CONNECT" "$ARGUMENTS"
@@ -58,14 +61,21 @@ is_pgsql_host_alive() {
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL]'
+args_usage='TYPE HOST DBUSER DBPASS [MAX_DB] [CHARSETS] [TPL] [PORT]'
 check_args '4' "$#" "$args_usage"
-is_format_valid 'host' 'dbuser' 'max_db' 'charsets' 'template'
+
+if [ -z $charsets ]; then charsets="UTF8,LATIN1,WIN1250,WIN1251,WIN1252,WIN1256,WIN1258,KOI8"; fi
+if [ -z $template ]; then template="template1"; fi
+
+database_set_default_ports
+
+is_format_valid 'host' 'dbuser' 'max_db' 'charsets' 'template' 'port'
 #is_system_enabled "$DB_SYSTEM" 'DB_SYSTEM'
 #is_type_valid "$DB_SYSTEM" "$type"
 is_dbhost_new
 is_password_valid
 dbpass="$password"
+
 case $type in
     mysql) is_mysql_host_alive ;;
     pgsql) is_pgsql_host_alive ;;
@@ -85,11 +95,11 @@ date=$(echo "$time_n_date" |cut -f 2 -d \ )
 case $type in
     mysql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'";
            str="$str CHARSETS='$charsets' MAX_DB='$max_db' U_SYS_USERS=''";
-           str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$time' DATE='$date'";;
+           str="$str U_DB_BASES='0' SUSPENDED='no' TIME='$time' DATE='$date' PORT='$port'";;
     pgsql) str="HOST='$host' USER='$dbuser' PASSWORD='$dbpass'";
            str="$str CHARSETS='$charsets' TPL='$template' MAX_DB='$max_db'";
            str="$str U_SYS_USERS='' U_DB_BASES='0' SUSPENDED='no'";
-           str="$str TIME='$time' DATE='$date'";;
+           str="$str TIME='$time' DATE='$date' PORT='$port'";;
 esac
 
 

+ 5 - 0
bin/v-add-mail-domain

@@ -102,6 +102,11 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then
         echo "$local_ip" > $HOMEDIR/$user/conf/mail/$domain/ip
     fi
 
+    # Touch mailhelo.conf if it doesnt exist
+    if [ ! -f "/etc/exim4/mailhelo.conf" ]; then
+        touch /etc/exim4/mailhelo.conf
+    fi
+
     # Setting HELO for mail domain
     if [ ! -z "$local_ip" ]; then
         IP_RDNS=$(is_ip_rdns_valid "$local_ip")

+ 7 - 2
bin/v-add-sys-webmail

@@ -1,7 +1,9 @@
 #!/bin/bash
 # info: add webmail support for a domain
-# options: USER DOMAIN [RESTART]
+# options: USER DOMAIN [RESTART] [QUIET]
 #
+# this function adds support for webmail services
+# to a mail domain.
 
 #----------------------------------------------------------#
 #                    Variable&Function                     #
@@ -11,6 +13,7 @@
 user=$1
 domain=$2
 restart="$3"
+quiet=$4
 
 # Additional argument formatting
 if [[ "$domain" =~ [[:upper:]] ]]; then
@@ -123,7 +126,9 @@ if [ "$3" = 'yes' ]; then
 fi
 
 # Logging
-log_history "enabled webmail support for $domain"
+if [ "$quiet" != 'yes' ]; then
+    log_history "enabled webmail support for $domain"
+fi
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 8 - 9
bin/v-add-user

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: add system user
-# options: USER PASSWORD EMAIL [PACKAGE] [FNAME] [LNAME]
+# options: USER PASSWORD EMAIL [PACKAGE] [NAME]
 #
 # The function creates new user account.
 
@@ -14,8 +14,7 @@ user=$1
 password=$2; HIDE=2
 email=$3
 package=${4-default}
-fname=$5
-lname=$6
+name=$5
 
 # Includes
 source $HESTIA/func/main.sh
@@ -32,11 +31,12 @@ is_user_free() {
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-check_args '3' "$#" 'USER PASSWORD EMAIL [PACKAGE] [FNAME] [LNAME]'
+check_args '3' "$#" 'USER PASSWORD EMAIL [PACKAGE] [NAME] '
 is_format_valid 'user' 'email' 'package'
-if [ ! -z "$fname" ]; then
-    is_format_valid 'fname' 'lname'
+if [ ! -z "$name" ]; then
+    is_format_valid 'name' 
 fi
+
 is_user_free "$user"
 is_password_valid
 is_package_valid
@@ -176,8 +176,7 @@ else
     u_users=1
 fi
 
-echo "FNAME='$fname'
-LNAME='$lname'
+echo "NAME='$name'
 PACKAGE='$package'
 $pkg_data
 CONTACT='$email'
@@ -230,7 +229,7 @@ fi
 
 # Run template trigger
 if [ -x "$HESTIA/data/packages/$package.sh" ]; then
-    $HESTIA/data/packages/$package.sh "$user" "$email" "$fname" "$lname"
+    $HESTIA/data/packages/$package.sh "$user" "$email" "$name"
 fi
 
 # Adding jailed sftp env

+ 0 - 125
bin/v-add-user-favourites

@@ -1,125 +0,0 @@
-#!/bin/bash
-# info: adding user favourites
-# options: USER SYSTEM OBJECT
-#
-# The function adds object to users favourites
-
-
-#----------------------------------------------------------#
-#                    Variable&Function                     #
-#----------------------------------------------------------#
-
-# Argument definition
-user=$1
-system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
-object=$3
-email=$3
-id=$3
-
-# Includes
-source $HESTIA/func/main.sh
-source $HESTIA/conf/hestia.conf
-
-
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '3' "$#" 'USER SYSTEM OBJECT'
-is_format_valid 'user' 'system'
-case $system in 
-    MAIL_ACC)   is_format_valid 'email' ;;
-    CRON)       is_format_valid 'id' ;;
-    DNS_REC)    is_format_valid 'id' ;;
-    *)          is_format_valid 'object'
-esac
-is_object_valid 'user' 'USER' "$user"
-is_object_unsuspended 'user' 'USER' "$user"
-
-# Checking system
-case $system in
-    USER)       check='ok' ;;
-    WEB)        check='ok' ;;
-    DNS)        check='ok' ;;
-    DNS_REC)    check='ok' ;;
-    MAIL)       check='ok' ;;
-    MAIL_ACC)   check='ok' ;;
-    DB)         check='ok' ;;
-    CRON)       check='ok' ;;
-    BACKUP)     check='ok' ;;
-    IP)         check='ok' ;;
-    PACKAGE)    check='ok' ;;
-    FIREWALL)   check='ok' ;;
-    *)      check_args '2' '0' 'USER SYSTEM OBJECT'
-esac
-
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Flushing vars
-USER=''
-WEB=''
-DNS=''
-DNS_REC=''
-MAIL=''
-MAIL_ACC=''
-DB=''
-CRON=''
-BACKUP=''
-IP=''
-PACKAGE=''
-FIREWALL=''
-
-# Creating config just in case
-touch $USER_DATA/favourites.conf
-
-# Reading current values
-source $USER_DATA/favourites.conf
-
-# Assigning current system value
-eval value=\$$system
-
-# Checking if object is new
-check_fav=$(echo "$value" |tr ',' '\n'| grep "^$object$")
-if [ ! -z "$check_fav" ]; then
-    exit 0
-fi
-
-# Adding object to favorites
-if [ -z "$value" ]; then
-    value="$object"
-else
-    value="$value,$object"
-fi
-
-# Updating sytem
-eval $system=$value
-
-# Updating user favorites
-echo "USER='$USER'
-WEB='$WEB'
-DNS='$DNS'
-DNS_REC='$DNS_REC'
-MAIL='$MAIL'
-MAIL_ACC='$MAIL_ACC'
-DB='$DB'
-CRON='$CRON'
-BACKUP='$BACKUP'
-IP='$IP'
-PACKAGE='$PACKAGE'
-FIREWALL='$FIREWALL'" > $USER_DATA/favourites.conf
-
-# Changing file permission
-chmod 640 $USER_DATA/favourites.conf
-
-#----------------------------------------------------------#
-#                       Hestia                             #
-#----------------------------------------------------------#
-
-# Logging
-log_history "added starred $object in $system listing"
-log_event "$OK" "$ARGUMENTS"
-
-exit

+ 11 - 10
bin/v-change-user-name

@@ -1,6 +1,6 @@
 #!/bin/bash
 # info: change user full name
-# options: USER FNAME LNAME
+# options: USER NAME
 #
 # The function allow to change user's full name.
 
@@ -11,7 +11,7 @@
 
 # Argument definition
 user=$1
-fname=$2
+name=$2
 lname=$3
 
 # Includes
@@ -23,8 +23,8 @@ source $HESTIA/conf/hestia.conf
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-check_args '3' "$#" 'USER FNAME LNAME'
-is_format_valid 'user' 'fname' 'lname'
+check_args '2' "$#" 'USER NAME'
+is_format_valid 'user' 'name'
 is_object_valid 'user' 'USER' "$user"
 is_object_unsuspended 'user' 'USER' "$user"
 
@@ -37,20 +37,21 @@ check_hestia_demo_mode
 #----------------------------------------------------------#
 
 # Get old values
-old_fname=$(get_user_value '$FNAME')
-old_lname=$(get_user_value '$LNAME')
+old_name=$(get_user_value '$NAME')
 
 # Changing ns values
-update_user_value "$user" '$FNAME' "$fname"
-update_user_value "$user" '$LNAME' "$lname"
-
+if [ ! -z "$lname" ]; then
+    update_user_value "$user" '$NAME' "$name $lname"
+else
+    update_user_value "$user" '$NAME' "$name"
+fi
 
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#
 
 # Logging
-log_history "changed user name to $fname $lname"
+log_history "changed user display name to $name"
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 1 - 0
bin/v-delete-cron-hestia-autoupdate

@@ -63,6 +63,7 @@ $BIN/v-restart-cron
 check_result $? "Cron restart failed" >/dev/null
 
 # Logging
+log_history "disabled automatic updates"
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 7 - 3
bin/v-delete-sys-webmail

@@ -1,8 +1,9 @@
 #!/bin/bash
 # info: delete webmail support for a domain
-# options: USER DOMAIN [RESTART]
+# options: USER DOMAIN [RESTART] [QUIET]
 #
-# The function delete ssl certificates.
+# this function removes support for webmail from
+# a specified mail domain.
 
 #----------------------------------------------------------#
 #                    Variable&Function                     #
@@ -12,6 +13,7 @@
 user=$1
 domain=$2
 restart="$3"
+quiet=$4
 
 # Includes
 source $HESTIA/func/main.sh
@@ -74,7 +76,9 @@ if [ ! -z "$3" ]; then
 fi
 
 # Logging
-log_history "disabled webmail support for $domain"
+if [ "$quiet" != 'yes' ]; then
+    log_history "disabled webmail support for $domain"
+fi
 log_event "$OK" "$ARGUMENTS"
 
 exit

+ 0 - 128
bin/v-delete-user-favourites

@@ -1,128 +0,0 @@
-#!/bin/bash
-# info: deleting user favourites
-# options: USER SYSTEM OBJECT
-#
-# The function deletes object from users favourites
-
-
-#----------------------------------------------------------#
-#                    Variable&Function                     #
-#----------------------------------------------------------#
-
-# Argument definition
-user=$1
-system=$(echo "$2" |tr '[:lower:]' '[:upper:]')
-object=$3
-email=$3
-id=$3
-
-# Includes
-source $HESTIA/func/main.sh
-source $HESTIA/conf/hestia.conf
-
-
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-check_args '3' "$#" 'USER SYSTEM OBJECT'
-case $system in 
-    MAIL_ACC)   is_format_valid 'email' ;;
-    CRON)       is_format_valid 'id' ;;
-    DNS_REC)    is_format_valid 'id' ;;
-    *)          is_format_valid 'object'
-esac
-is_format_valid 'user'
-is_object_valid 'user' 'USER' "$user"
-is_object_unsuspended 'user' 'USER' "$user"
-
-# Checking system
-case $system in
-    USER)       check='ok' ;;
-    WEB)        check='ok' ;;
-    DNS)        check='ok' ;;
-    DNS_REC)    check='ok' ;;
-    MAIL)       check='ok' ;;
-    MAIL_ACC)   check='ok' ;;
-    DB)         check='ok' ;;
-    CRON)       check='ok' ;;
-    BACKUP)     check='ok' ;;
-    IP)         check='ok' ;;
-    PACKAGE)    check='ok' ;;
-    FIREWALL)   check='ok' ;;
-    *)      check_args '2' '0' 'USER SYSTEM OBJECT'
-esac
-
-# Perform verification if read-only mode is enabled
-check_hestia_demo_mode
-
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Flushing vars
-USER=''
-WEB=''
-DNS=''
-DNS_REC=''
-MAIL=''
-MAIL_ACC=''
-DB=''
-CRON=''
-BACKUP=''
-IP=''
-PACKAGE=''
-FIREWALL=''
-
-# Creating config just in case
-touch $USER_DATA/favourites.conf
-
-# Reading current values
-source $USER_DATA/favourites.conf
-
-# Assigning current system value
-eval value=\$$system
-
-# Checking if object is new
-check_fav=$(echo "$value" |tr ',' '\n'| grep "^$object$")
-if [ -z "$check_fav" ]; then
-    exit 0
-fi
-
-# Deleting object from favorites
-value=$(echo "$value" |\
-    sed -e "s/,/\n/g"|\
-    sed -e "s/^$object$//g"|\
-    sed -e "/^$/d"|\
-    sed -e ':a;N;$!ba;s/\n/,/g')
-
-# Updating sytem
-eval $system=$value
-
-# Updating user favorites
-echo "USER='$USER'
-WEB='$WEB'
-DNS='$DNS'
-DNS_REC='$DNS_REC'
-MAIL='$MAIL'
-MAIL_ACC='$MAIL_ACC'
-DB='$DB'
-CRON='$CRON'
-BACKUP='$BACKUP'
-IP='$IP'
-PACKAGE='$PACKAGE'
-FIREWALL='$FIREWALL'" > $USER_DATA/favourites.conf
-
-# Changing file permission
-chmod 640 $USER_DATA/favourites.conf
-
-#----------------------------------------------------------#
-#                       Hestia                             #
-#----------------------------------------------------------#
-
-# Logging
-log_history "deleted starred $object from $system listing"
-log_event "$OK" "$ARGUMENTS"
-
-exit

+ 6 - 4
bin/v-download-backup

@@ -169,6 +169,9 @@ if [ ! -e "$BACKUP/$backup" ]; then
         downloaded='yes'
     fi
     if [ -z "$downloaded" ]; then
+        subj="Download of $backup failed for $user"
+        $BIN/v-add-user-notification $user "$subj" "<b>Unable to retrieve backup file from remote server.</b><br><b>Error:</b> $backup file doesn't exist in '${BACKUP}' directory."
+        sed -i "/v-download-backup $user /d" $HESTIA/data/queue/backup.pipe
         check_result $E_NOTEXIST "backup file $backup doesn't exist in '${BACKUP}' folder"
     else
         if [ -e "$BACKUP/$backup" ]; then
@@ -186,11 +189,10 @@ fi
 # Send notification
 if [ -e "$BACKUP/$backup" ]; then
     cd $BACKUP
-    subj="$user → Download of $backup has been completed"
+    subj="Download of $backup completed for $user"
     email=$(get_user_value '$CONTACT')
-    echo "Download of $backup has been completed you are able to download it for 12 hours" |$SENDMAIL -s "$subj" $email $notify
-    $BIN/v-add-user-notification $user "$subj" "Download of $backup has been completed you are able to download it for 12 hours"
-    
+    echo "Backup file $backup was retrieved from the remote server and will be available to download for 12 hours." | $SENDMAIL -s "$subj" $email $notify
+    $BIN/v-add-user-notification $user "$subj" "Backup file <b>$backup</b> was retrieved from the remote server and will be available to download for <b>12 hours</b>."
 fi
 
 # Cleaning restore queue

+ 8 - 3
bin/v-list-database-host

@@ -16,12 +16,14 @@ format=${3-shell}
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/db.sh
 
 # JSON list function
 json_list() {
     echo '{'
     echo '    "'$HOST'": {
         "HOST": "'$HOST'",
+        "PORT": "'$PORT'",
         "TYPE": "'$type'",
         "CHARSETS": "'$CHARSETS'",
         "MAX_DB": "'$MAX_DB'",
@@ -38,6 +40,7 @@ json_list() {
 # SHELL list function
 shell_list() {
     echo "HOST:           $HOST"
+    echo "PORT:           $PORT"
     echo "TYPE:           $type"
     echo "CHARSETS:       $CHARSETS"
     echo "MAX_DB:         $MAX_DB"
@@ -51,15 +54,15 @@ shell_list() {
 
 # PLAIN list function
 plain_list() {
-    echo -ne "$HOST\t$type\t$CHARSETS\t$MAX_DB\t$U_SYS_USERS\t"
+    echo -ne "$HOST\t$PORT\t$type\t$CHARSETS\t$MAX_DB\t$U_SYS_USERS\t"
     echo -e "$U_DB_BASES\t$TPL\t$SUSPENDED\t$TIME\t$DATE"
 }
 
 # CSV list function
 csv_list() {
-    echo -n "HOST,TYPE,CHARSETS,MAX_DB,U_SYS_USERS,"
+    echo -n "HOST,PORT,TYPE,CHARSETS,MAX_DB,U_SYS_USERS,"
     echo "U_DB_BASES,TPL,SUSPENDED,TIME,DATE'"
-    echo -n "$HOST,$type,\"$CHARSETS\",$MAX_DB,\"$U_SYS_USERS\","
+    echo -n "$HOST,$PORT,$type,\"$CHARSETS\",$MAX_DB,\"$U_SYS_USERS\","
     echo "$U_DB_BASES,$TPL,$SUSPENDED,$TIME,$DATE"
 }
 
@@ -81,6 +84,8 @@ is_format_valid 'host'
 is_type_format_valid "$type"
 is_object_valid "../../conf/$type" 'HOST' "$host"
 
+# Set default port values if they don't exist in host configuration file
+database_set_default_ports
 
 #----------------------------------------------------------#
 #                       Action                             #

+ 16 - 7
bin/v-list-database-hosts

@@ -14,6 +14,7 @@ format=${1-shell}
 
 # Includes
 source $HESTIA/func/main.sh
+source $HESTIA/func/db.sh
 source $HESTIA/conf/hestia.conf
 
 # JSON list function
@@ -23,6 +24,8 @@ json_list() {
     objects=0
     for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
         if [ -e "$HESTIA/conf/$type.conf" ]; then
+            # Set default port values if they don't exist in database configuration file.
+            database_set_default_ports
             db_hosts=$(grep HOST $HESTIA/conf/$type.conf |wc -l)
             objects=$((objects + db_hosts))
         fi
@@ -35,6 +38,7 @@ json_list() {
                 parse_object_kv_list "$str"
         echo -n '    {
         "HOST": "'$HOST'",
+        "PORT": "'$PORT'",
         "TYPE": "'$type'",
         "CHARSETS": "'$CHARSETS'",
         "MAX_DB": "'$MAX_DB'",
@@ -60,13 +64,15 @@ json_list() {
 # SHELL list function
 shell_list() {
     IFS=$'\n'
-    echo "HOST   TYPE   MAX_DB   DB_USED   SPND   TIME   DATE"
-    echo "----   ----   ------   -------   ----   ----   ----"
+    echo "HOST   PORT   TYPE   MAX_DB   DB_USED   SPND   TIME   DATE"
+    echo "----   ----   ----   ------   -------   ----   ----   ----"
     for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
         if [ -e "$HESTIA/conf/$type.conf" ]; then
+            # Set default port values if they don't exist in database configuration file.
+            database_set_default_ports
             for str in $(cat $HESTIA/conf/$type.conf); do
                 parse_object_kv_list "$str"
-                echo "$HOST $type $MAX_DB $U_DB_BASES $SUSPENDED $TIME $DATE"
+                echo "$HOST $PORT $type $MAX_DB $U_DB_BASES $SUSPENDED $TIME $DATE"
             done
         fi
     done
@@ -77,9 +83,11 @@ plain_list() {
     IFS=$'\n'
     for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
         if [ -e "$HESTIA/conf/$type.conf" ]; then
+            # Set default port values if they don't exist in database configuration file.
+            database_set_default_ports
             for str in $(cat $HESTIA/conf/$type.conf); do
                 parse_object_kv_list "$str"
-                echo -ne "$HOST\t$type\t$CHARSETS\t$MAX_DB\t$U_SYS_USERS\t"
+                echo -ne "$HOST\t$PORT\t$type\t$CHARSETS\t$MAX_DB\t$U_SYS_USERS\t"
                 echo -e "$U_DB_BASES\t$TPL\t$SUSPENDED\t$TIME\t$DATE"
             done
         fi
@@ -89,13 +97,15 @@ plain_list() {
 # CSV list function
 csv_list() {
     IFS=$'\n'
-    echo -n "HOST,TYPE,CHARSETS,MAX_DB,U_SYS_USERS,"
+    echo -n "HOST,PORT,TYPE,CHARSETS,MAX_DB,U_SYS_USERS,"
     echo "U_DB_BASES,TPL,SUSPENDED,TIME,DATE"
     for type in $(echo $DB_SYSTEM |sed -e 's/,/\n/'); do
         if [ -e "$HESTIA/conf/$type.conf" ]; then
+            # Set default port values if they don't exist in database configuration file.
+            database_set_default_ports
             for str in $(cat $HESTIA/conf/$type.conf); do
                 parse_object_kv_list "$str"
-                echo -n "$HOST,$type,\"$CHARSETS\",$MAX_DB,\"$U_SYS_USERS\","
+                echo -n "$HOST,$PORT,$type,\"$CHARSETS\",$MAX_DB,\"$U_SYS_USERS\","
                 echo "$U_DB_BASES,$TPL,$SUSPENDED,$TIME,$DATE"
             done
         fi
@@ -115,7 +125,6 @@ is_type_format_valid() {
 #                    Verifications                         #
 #----------------------------------------------------------#
 
-
 #----------------------------------------------------------#
 #                       Action                             #
 #----------------------------------------------------------#

+ 5 - 6
bin/v-list-user

@@ -20,8 +20,7 @@ source $HESTIA/func/main.sh
 json_list() {
         echo '{
     "'$USER'": {
-        "FNAME": "'$FNAME'",
-        "LNAME": "'$LNAME'",
+        "NAME": "'$NAME'",
         "PACKAGE": "'$PACKAGE'",
         "WEB_TEMPLATE": "'$WEB_TEMPLATE'",
         "BACKEND_TEMPLATE": "'$BACKEND_TEMPLATE'",
@@ -85,7 +84,7 @@ json_list() {
 # SHELL list function
 shell_list() {
     echo "USERNAME:       $USER"
-    echo "FULL NAME:      $FNAME $LNAME"
+    echo "FULL NAME:      $NAME"
     echo "EMAIL:          $CONTACT"
     echo "LANGUAGE:       $LANGUAGE"
     echo "SUSPENDED:      $SUSPENDED"
@@ -109,7 +108,7 @@ shell_list() {
 
 # PLAIN list function
 plain_list() {
-    echo -ne "$USER\t$FNAME\t$LNAME\t$PACKAGE\t$WEB_TEMPLATE\t"
+    echo -ne "$USER\t$NAME\t$PACKAGE\t$WEB_TEMPLATE\t"
     echo -ne "$BACKEND_TEMPLATE\t$PROXY_TEMPLATE\t$DNS_TEMPLATE\t"
     echo -ne "$WEB_DOMAINS\t$WEB_ALIASES\t$DNS_DOMAINS\t$DNS_RECORDS\t"
     echo -ne "$MAIL_DOMAINS\t$MAIL_ACCOUNTS\t$DATABASES\t$CRON_JOBS\t"
@@ -127,7 +126,7 @@ plain_list() {
 
 # CSV list function
 csv_list() {
-    echo -n "USER,FNAME,LNAME,PACKAGE,WEB_TEMPLATE,BACKEND_TEMPLATE,"
+    echo -n "USER,NAME,PACKAGE,WEB_TEMPLATE,BACKEND_TEMPLATE,"
     echo -n "PROXY_TEMPLATE,DNS_TEMPLATE,WEB_DOMAINS,WEB_ALIASES,"
     echo -n "DNS_DOMAINS,DNS_RECORDS,MAIL_DOMAINS,MAIL_ACCOUNTS,"
     echo -n "DATABASES,CRON_JOBS,DISK_QUOTA,BANDWIDTH,NS,HOME,SHELL,"
@@ -138,7 +137,7 @@ csv_list() {
     echo -n "U_WEB_SSL,U_WEB_ALIASES,U_DNS_DOMAINS,U_DNS_RECORDS,"
     echo -n "U_MAIL_DOMAINS,U_MAIL_DKIM,U_MAIL_ACCOUNTS,U_DATABASES"
     echo "U_CRON_JOBS,U_BACKUPS,LANGUAGE,NOTIFICATIONS,TIME,DATE"
-    echo -n "$USER,\"$FNAME\",\"$LNAME\",$PACKAGE,$WEB_TEMPLATE,"
+    echo -n "$USER,\"$NAME\",$PACKAGE,$WEB_TEMPLATE,"
     echo -n "$BACKEND_TEMPLATE,$PROXY_TEMPLATE,$DNS_TEMPLATE,$WEB_DOMAINS,"
     echo -n "$WEB_ALIASES,$DNS_DOMAINS,$DNS_RECORDS,$MAIL_DOMAINS,"
     echo -n "$MAIL_ACCOUNTS,$DATABASES,$CRON_JOBS,$DISK_QUOTA,$BANDWIDTH,"

+ 0 - 117
bin/v-list-user-favourites

@@ -1,117 +0,0 @@
-#!/bin/bash
-# info: list user favourites
-# options: USER [FORMAT]
-#
-# The function for getting the list of favourite user objects
-
-
-#----------------------------------------------------------#
-#                    Variable&Function                     #
-#----------------------------------------------------------#
-
-# Argument definition
-user=$1
-format=${2-shell}
-
-# Includes
-source $HESTIA/func/main.sh
-
-# JSON list function
-json_list() {
-    echo '{'
-    echo '    "Favourites": {
-        "USER": "'$USER'",
-        "WEB": "'$WEB'",
-        "DNS": "'$DN'",
-        "DNS_REC": "'$DNS_REC'",
-        "MAIL": "'$MAIL'",
-        "MAIL_ACC": "'$MAIL_ACC'",
-        "DB": "'$DB'",
-        "CRON": "'$CRON'",
-        "BACKUP": "'$BACKUP'",
-        "IP": "'$IP'",
-        "PACKAGE": "'$PACKAGE'",
-        "FIREWALL": "'$FIREWALL'"
-        }'
-    echo '}'
-}
-
-# SHELL list function
-shell_list() {
-    echo "USER:           $USER"
-    echo "WEB:            $WEB"
-    echo "DNS:            $DNS"
-    echo "DNS RECORD:     $DNS_REC"
-    echo "MAIL:           $MAIL"
-    echo "MAIL USER:      $MAIL_ACC"
-    echo "DATABASE:       $DB"
-    echo "CRON:           $CRON"
-    echo "BACKUP:         $BACKUP"
-    echo "IP:             $IP"
-    echo "PACKAGE:        $PACKAGE"
-    echo "FIREWALL:       $FIREWALL"
-}
-
-# PLAIN list function
-plain_list() {
-    echo -ne "$USER\t$WEB\t$DNS\t$DNS_REC\t$MAIL\t$MAIL_ACC\t$DB\t$CRON\t"
-    echo -e "$BACKUP\t$IP\t$PACKAGE\t$FIREWALL"
-}
-
-# CSV list function
-csv_list() {
-    echo -n "USER,WEB,DNS,DNS_REC,MAIL,MAIL_ACC,DB,CRON,BACKUP,IP,"
-    echo "PACKAGE,FIREWALL"
-    echo -n "\"$USER\",\"$WEB\",\"$DNS\",\"$DNS_REC\",\"$MAIL\","
-    echo -n "\"$MAIL_ACC\",\"$DB\",\"$CRON\",\"$BACKUP\",\"$IP\","
-    echo "\"$PACKAGE\",\"$FIREWALL\""
-}
-
-
-#----------------------------------------------------------#
-#                    Verifications                         #
-#----------------------------------------------------------#
-
-# Checking args
-check_args '1' "$#" 'USER [FORMAT]'
-is_format_valid 'user'
-is_object_valid 'user' 'USER' "$user"
-
-
-#----------------------------------------------------------#
-#                       Action                             #
-#----------------------------------------------------------#
-
-# Flushing vars
-USER=''
-WEB=''
-DNS=''
-DNS_REC=''
-MAIL=''
-MAIL_ACC=''
-DB=''
-CRON=''
-BACKUP=''
-IP=''
-PACKAGE=''
-FIREWALL=''
-
-# Parsing user favourites
-if [ -e "$HESTIA/data/users/$user/favourites.conf" ]; then
-    source $HESTIA/data/users/$user/favourites.conf
-fi
-
-# Listing data
-case $format in
-    json)   json_list ;;
-    plain)  plain_list ;;
-    csv)    csv_list ;;
-    shell)  shell_list ;;
-esac
-
-
-#----------------------------------------------------------#
-#                       Hestia                             #
-#----------------------------------------------------------#
-
-exit

+ 4 - 5
bin/v-list-users

@@ -26,8 +26,7 @@ json_list() {
         fi
         source $HESTIA/data/users/$USER/user.conf
         echo -n '    "'$USER'": {
-        "FNAME": "'$FNAME'",
-        "LNAME": "'$LNAME'",
+        "NAME": "'$NAME'",
         "PACKAGE": "'$PACKAGE'",
         "WEB_TEMPLATE": "'$WEB_TEMPLATE'",
         "BACKEND_TEMPLATE": "'$BACKEND_TEMPLATE'",
@@ -108,7 +107,7 @@ plain_list() {
             continue;
         fi
         source $HESTIA/data/users/$USER/user.conf
-        echo -ne "$USER\t$FNAME\t$LNAME\t$PACKAGE\t$WEB_TEMPLATE\t"
+        echo -ne "$USER\t$NAME\t$PACKAGE\t$WEB_TEMPLATE\t"
         echo -ne "$BACKEND_TEMPLATE\t$PROXY_TEMPLATE\t$DNS_TEMPLATE\t"
         echo -ne "$WEB_DOMAINS\t$WEB_ALIASES\t$DNS_DOMAINS\t$DNS_RECORDS\t"
         echo -ne "$MAIL_DOMAINS\t$MAIL_ACCOUNTS\t$DATABASES\t$CRON_JOBS\t"
@@ -127,7 +126,7 @@ plain_list() {
 
 # CSV list function
 csv_list() {
-    echo -n "USER,FNAME,LNAME,PACKAGE,WEB_TEMPLATE,BACKEND_TEMPLATE,"
+    echo -n "USER,NAME,PACKAGE,WEB_TEMPLATE,BACKEND_TEMPLATE,"
     echo -n "PROXY_TEMPLATE,DNS_TEMPLATE,WEB_DOMAINS,WEB_ALIASES,"
     echo -n "DNS_DOMAINS,DNS_RECORDS,MAIL_DOMAINS,MAIL_ACCOUNTS,"
     echo -n "DATABASES,CRON_JOBS,DISK_QUOTA,BANDWIDTH,NS,HOME,SHELL,"
@@ -144,7 +143,7 @@ csv_list() {
             continue;
         fi
         source $HESTIA/data/users/$USER/user.conf
-        echo -n "$USER,\"$FNAME\",\"$LNAME\",$PACKAGE,$WEB_TEMPLATE,"
+        echo -n "$USER,\"$NAME\",$PACKAGE,$WEB_TEMPLATE,"
         echo -n "$BACKEND_TEMPLATE,$PROXY_TEMPLATE,$DNS_TEMPLATE,"
         echo -n "$WEB_DOMAINS,$WEB_ALIASES,$DNS_DOMAINS,$DNS_RECORDS,"
         echo -n "$MAIL_DOMAINS,$MAIL_ACCOUNTS,$DATABASES,$CRON_JOBS,"

+ 62 - 0
bin/v-rebuild-all

@@ -0,0 +1,62 @@
+#!/bin/bash
+# info: rebuild all assets for a specified user
+# options: USER [RESTART]
+#
+# The function rebuilds all assets for a user account:
+# - Web domains
+# - DNS zones
+# - Mail domains
+# - Databases
+# - Cron Jobs
+# - User account configuration
+
+#----------------------------------------------------------#
+#                    Variable&Function                     #
+#----------------------------------------------------------#
+
+# Argument definition
+user=$1
+restart=$2
+
+# Includes
+source $HESTIA/func/main.sh
+source $HESTIA/func/rebuild.sh
+source $HESTIA/conf/hestia.conf
+
+# Export sbin
+export PATH=$PATH:/usr/sbin
+
+
+#----------------------------------------------------------#
+#                    Verifications                         #
+#----------------------------------------------------------#
+
+check_args '1' "$#" 'USER [RESTART]'
+is_format_valid 'user'
+is_object_valid 'user' 'USER' "$user"
+is_object_unsuspended 'user' 'USER' "$user"
+
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+
+# Rebuild loop
+for user in $($HESTIA/bin/v-list-sys-users plain); do
+    $BIN/v-rebuild-web-domains $user $restart
+    $BIN/v-rebuild-dns-domains $user $restart
+    $BIN/v-rebuild-mail-domains $user $restart
+    $BIN/v-rebuild-databases $user $restart
+    $BIN/v-rebuild-cron-jobs $user $restart
+    $BIN/v-rebuild-user $user $restart
+done
+
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+# Logging
+log_event "$OK" "$ARGUMENTS"
+
+exit

+ 2 - 2
bin/v-rebuild-mail-domain

@@ -54,8 +54,8 @@ rebuild_mail_domain_conf
 # Rebuild webmail configuration
 if [ ! -z "$WEB_SYSTEM" ] || [ ! -z "$PROXY_SYSTEM" ]; then
     if [ ! -z "$IMAP_SYSTEM" ]; then
-        $BIN/v-delete-sys-webmail $user $domain ''
-        $BIN/v-add-sys-webmail $user $domain ''
+        $BIN/v-delete-sys-webmail $user $domain '' 'yes'
+        $BIN/v-add-sys-webmail $user $domain '' 'yes'
     fi
 fi
 

+ 2 - 2
bin/v-rebuild-mail-domains

@@ -57,8 +57,8 @@ for domain in $(search_objects 'mail' 'SUSPENDED' "*" 'DOMAIN'); do
     rebuild_mail_domain_conf
     if [ ! -z "$WEB_SYSTEM" ] || [ ! -z "$PROXY_SYSTEM" ]; then
         if [ ! -z "$IMAP_SYSTEM" ]; then
-            $BIN/v-delete-sys-webmail $user $domain ''
-            $BIN/v-add-sys-webmail $user $domain ''
+            $BIN/v-delete-sys-webmail $user $domain '' 'yes'
+            $BIN/v-add-sys-webmail $user $domain '' 'yes'
         fi
     fi
 done

+ 34 - 3
func/db.sh

@@ -1,19 +1,48 @@
+# Global
+database_set_default_ports() {
+
+    # Set default ports for MySQL and PostgreSQL
+    mysql_default="3306"
+    pgsql_default="5432"
+
+    # Handle missing values for both $PORT and $port
+    # however don't override both at once or custom ports will be overridden.
+
+    if [ -z "$PORT" ]; then 
+        if [ "$type" = 'mysql' ]; then 
+            PORT="$mysql_default"
+        fi
+        if [ "$type" = 'pgsql' ]; then
+            PORT="$pgsql_default"
+        fi
+    fi
+    if [ -z "$port" ]; then 
+        if [ "$type" = 'mysql' ]; then 
+            port="$mysql_default"
+        fi
+        if [ "$type" = 'pgsql' ]; then
+            port="$pgsql_default"
+        fi
+    fi
+}
+
 # MySQL
 mysql_connect() {
     host_str=$(grep "HOST='$1'" $HESTIA/conf/mysql.conf)
     parse_object_kv_list "$host_str"
+    if [ -z $PORT ]; then PORT=3306; fi
     if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ]; then
         echo "Error: mysql config parsing failed"
         log_event "$E_PARSING" "$ARGUMENTS"
         exit $E_PARSING
     fi
-
     mycnf="$HESTIA/conf/.mysql.$HOST"
     if [ ! -e "$mycnf" ]; then
         echo "[client]">$mycnf
         echo "host='$HOST'" >> $mycnf
         echo "user='$USER'" >> $mycnf
         echo "password='$PASSWORD'" >> $mycnf
+        echo "port='$PORT'" >> $mycnf
         chmod 600 $mycnf
     else
         mypw=$(grep password $mycnf|cut -f 2 -d \')
@@ -22,6 +51,7 @@ mysql_connect() {
             echo "host='$HOST'" >> $mycnf
             echo "user='$USER'" >> $mycnf
             echo "password='$PASSWORD'" >> $mycnf
+            echo "port='$PORT'" >> $mycnf
             chmod 660 $mycnf
         fi
     fi
@@ -73,13 +103,14 @@ psql_connect() {
     host_str=$(grep "HOST='$1'" $HESTIA/conf/pgsql.conf)
     parse_object_kv_list "$host_str"
     export PGPASSWORD="$PASSWORD"
+    if [ -z $PORT ]; then PORT=5432; fi
     if [ -z $HOST ] || [ -z $USER ] || [ -z $PASSWORD ] || [ -z $TPL ]; then
         echo "Error: postgresql config parsing failed"
         log_event "$E_PARSING" "$ARGUMENTS"
         exit $E_PARSING
     fi
-
-    psql -h $HOST -U $USER -c "SELECT VERSION()" > /dev/null 2>/tmp/e.psql
+    
+    psql -h $HOST -U $USER -p $PORT -c "SELECT VERSION()" > /dev/null 2>/tmp/e.psql
     if [ '0' -ne "$?" ]; then
         if [ "$notify" != 'no' ]; then
             echo -e "Can't connect to PostgreSQL $HOST\n$(cat /tmp/e.psql)" |\

+ 3 - 1
func/ip.sh

@@ -31,7 +31,9 @@ is_ip_rdns_valid() {
     local awk_ip=$(echo $network_ip | sed 's|\.|/\&\&/|g')
     local rev_awk_ip=$(echo $awk_ip | rev)
 
-    [ -z "$rdns" ] && local rdns=$(dig +short -x $ip | head -n 1 | sed 's/.$//')
+    if [ -z "$rdns" ]; then
+        local rdns=$(dig +short -x "$ip" | head -n 1 | sed 's/.$//') || unset rdns
+    fi
 
     if [ ! -z "$rdns" ] && [ ! $(echo $rdns | awk "/$awk_ip/ || /$rev_awk_ip/") ]; then
         echo $rdns

+ 1 - 2
func/main.sh

@@ -933,7 +933,6 @@ is_format_valid() {
                 email_forward)  is_email_format_valid "$arg" ;;
                 exp)            is_date_format_valid "$arg" ;;
                 extentions)     is_common_format_valid "$arg" 'extentions' ;;
-                fname)          is_name_format_valid "$arg" "first name" ;;
                 ftp_password)   is_password_format_valid "$arg" ;;
                 ftp_user)       is_user_format_valid "$arg" "$arg_name" ;;
                 host)           is_object_format_valid "$arg" "$arg_name" ;;
@@ -944,11 +943,11 @@ is_format_valid() {
                 ip_status)      is_ip_status_format_valid "$arg" ;;
                 job)            is_int_format_valid "$arg" 'job' ;;
                 key)            is_user_format_valid "$arg" "$arg_name" ;;
-                lname)          is_name_format_valid "$arg" "last name" ;;
                 malias)         is_user_format_valid "$arg" "$arg_name" ;;
                 max_db)         is_int_format_valid "$arg" 'max db';;
                 min)            is_cron_format_valid "$arg" $arg_name ;;
                 month)          is_cron_format_valid "$arg" $arg_name ;;
+                name)           is_name_format_valid "$arg" "name" ;;
                 nat_ip)         is_ip_format_valid "$arg" ;;
                 netmask)        is_ip_format_valid "$arg" 'netmask' ;;
                 newid)          is_int_format_valid "$arg" 'id' ;;

+ 8 - 1
func/rebuild.sh

@@ -13,10 +13,17 @@ rebuild_user_conf() {
     chmod 660 $USER_DATA/history.log
     touch $USER_DATA/stats.log
     chmod 660 $USER_DATA/stats.log
+    
+    # Update FNAME LNAME to NAME
+    if [ -z "$NAME" ]; then 
+        NAME="$FNAME $LNAME"
+        sed -i "s/FNAME='$FNAME'/NAME='$NAME'/g" $USER_DATA/user.conf
+        sed -i "/LNAME='$LNAME'/d" $USER_DATA/user.conf  
+    fi
 
     # Run template trigger
     if [ -x "$HESTIA/data/packages/$PACKAGE.sh" ]; then
-        $HESTIA/data/packages/$PACKAGE.sh "$user" "$CONTACT" "$FNAME" "$LNAME"
+        $HESTIA/data/packages/$PACKAGE.sh "$user" "$CONTACT" "$NAME"
     fi
 
     # Rebuild user

+ 119 - 22
func/upgrade.sh

@@ -61,9 +61,103 @@ upgrade_complete_message() {
 
 upgrade_init_backup() {
     # Ensure that backup directories are created
-    mkdir -p $HESTIA_BACKUP/conf/
+    # Hestia Control Panel configuration files
+    mkdir -p $HESTIA_BACKUP/conf/hestia/
+    
+    # Hosting Packages
     mkdir -p $HESTIA_BACKUP/packages/
+
+    # Domain template files
     mkdir -p $HESTIA_BACKUP/templates/
+
+    # System services (apache2, nginx, bind9, vsftpd, etc).
+    if [ ! -z "$WEB_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$WEB_SYSTEM/
+    fi
+    if [ ! -z "$IMAP_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$IMAP_SYSTEM/
+    fi
+    if [ ! -z "$MAIL_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$MAIL_SYSTEM/
+    fi
+    if [ ! -z "$DNS_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$DNS_SYSTEM/
+    fi
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$PROXY_SYSTEM/
+    fi
+    if [ ! -z "$DB_SYSTEM" ]; then
+        if [[  "$DB_SYSTEM" =~ "mysql" ]]; then 
+            mkdir -p $HESTIA_BACKUP/conf/mysql/        
+        fi
+        if [[  "$DB_SYSTEM" =~ "pgsql" ]]; then 
+            mkdir -p $HESTIA_BACKUP/conf/pgsql/        
+        fi       
+    fi
+    if [ ! -z "$FTP_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$FTP_SYSTEM/
+    fi
+    if [ ! -z "$FIREWALL_SYSTEM" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$FIREWALL_SYSTEM/
+    fi
+    if [ ! -z "$FIREWALL_EXTENSION" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/$FIREWALL_EXTENSION/
+    fi
+    if [ -e "/etc/ssh/sshd_config" ]; then
+        mkdir -p $HESTIA_BACKUP/conf/ssh/
+    fi
+
+    echo "[ * ] Backing up existing templates and configuration files..."
+
+    cp -rf $HESTIA/data/packages/* $HESTIA_BACKUP/packages/
+
+    cp -rf $HESTIA/data/templates/* $HESTIA_BACKUP/templates/
+
+    # Hestia Control Panel configuration files
+    cp -rf $HESTIA/conf/* $HESTIA_BACKUP/conf/hestia/
+
+    # System service configuration files (apache2, nginx, bind9, vsftpd, etc).
+    if [ ! -z "$WEB_SYSTEM" ]; then
+        cp -f /etc/$WEB_SYSTEM/*.conf $HESTIA_BACKUP/conf/$WEB_SYSTEM/
+        cp -f /etc/$WEB_SYSTEM/conf.d/*.conf $HESTIA_BACKUP/conf/$WEB_SYSTEM/
+    fi
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        cp -f /etc/$PROXY_SYSTEM/*.conf $HESTIA_BACKUP/conf/$PROXY_SYSTEM/
+        cp -f /etc/$PROXY_SYSTEM/conf.d/*.conf $HESTIA_BACKUP/conf/$PROXY_SYSTEM/
+        cp -f /etc/$PROXY_SYSTEM/conf.d/*.inc $HESTIA_BACKUP/conf/$PROXY_SYSTEM/
+    fi
+    if [ ! -z "$IMAP_SYSTEM" ]; then
+        cp -f /etc/$IMAP_SYSTEM/*.conf $HESTIA_BACKUP/conf/$IMAP_SYSTEM/
+        cp -f /etc/$IMAP_SYSTEM/conf.d/*.conf $HESTIA_BACKUP/conf/$IMAP_SYSTEM/
+    fi
+    if [ ! -z "$MAIL_SYSTEM" ]; then
+        cp -f /etc/$MAIL_SYSTEM/*.conf $HESTIA_BACKUP/conf/$MAIL_SYSTEM/
+    fi
+    if [ ! -z "$DNS_SYSTEM" ]; then
+        if [ "$DNS_SYSTEM" = "bind9" ]; then
+            cp -f /etc/bind/*.conf $HESTIA_BACKUP/conf/$DNS_SYSTEM/
+        fi
+    fi
+    if [ ! -z "$DB_SYSTEM" ]; then    
+        if [[  "$DB_SYSTEM" =~ "mysql" ]]; then 
+            cp -f /etc/mysql/*.cnf $HESTIA_BACKUP/conf/mysql/
+            cp -f /etc/mysql/conf.d/*.cnf $HESTIA_BACKUP/conf/mysql/      
+        fi
+        if [[  "$DB_SYSTEM" =~ "pgsql" ]]; then 
+            cp -f /etc/mysql/*.cnf $HESTIA_BACKUP/conf/pgsql/
+            cp -f /etc/mysql/conf.d/*.cnf $HESTIA_BACKUP/conf/pgsql/         
+        fi
+    fi
+    if [ ! -z "$FTP_SYSTEM" ]; then
+        cp -f /etc/$FTP_SYSTEM.conf $HESTIA_BACKUP/conf/$FTP_SYSTEM/
+    fi
+    if [ ! -z "$FIREWALL_EXTENSION" ]; then
+        cp -f /etc/$FIREWALL_EXTENSION/*.conf $HESTIA_BACKUP/conf/$FIREWALL_EXTENSION/
+        cp -f /etc/$FIREWALL_EXTENSION/*.local $HESTIA_BACKUP/conf/$FIREWALL_EXTENSION/
+    fi
+    if [ -e "/etc/ssh/sshd_config" ]; then
+        cp -f /etc/ssh/sshd_config $HESTIA_BACKUP/conf/ssh/sshd_config
+    fi
 }
 
 upgrade_refresh_config() {
@@ -164,11 +258,34 @@ upgrade_start_routine() {
 
     # Upgrade to Version 1.2.0
     if [ $VERSION = "1.1.1" ] || [ $VERSION = "1.1.2" ]; then
+        source $HESTIA/install/upgrade/versions/previous/1.2.0.sh
+        VERSION="1.2.1"
+        upgrade_set_version $VERSION
+        upgrade_refresh_config
+    fi
+
+
+    # Upgrade to Version 1.2.1
+    if [ $VERSION = "1.2.0" ]; then
+        # Process steps which may not have correctly executed from v1.1.0.
+        echo
+        echo "[ ! ] Reprocessing steps from v1.1.0 due to a previous installer bug..."
+        echo
+        source $HESTIA/install/upgrade/versions/previous/1.1.0.sh
+        source $HESTIA/install/upgrade/versions/previous/1.2.0.sh
+        VERSION="1.2.1"
+        upgrade_refresh_config
+    fi
+
+
+    # Upgrade to Version 1.2.2
+    if [ $VERSION = "1.2.1" ]; then
         source $HESTIA/install/upgrade/versions/latest.sh
         VERSION="$new_version"
         upgrade_refresh_config
     fi
 
+
     #####################################################################
     #######     End version-specific upgrade instruction sets     #######
     #####################################################################
@@ -217,27 +334,6 @@ upgrade_phpmyadmin() {
     fi
 }
 
-update_php_templates() {
-    echo "[ * ] Updating default PHP templates..."
-    # Update default template
-    cp -f $HESTIA_INSTALL_DIR/templates/web/php-fpm/default.tpl \
-        $HESTIA/data/templates/web/php-fpm/default.tpl
-
-    # Update no-php template
-    cp -f $HESTIA_INSTALL_DIR/templates/web/php-fpm/no-php.tpl \
-        $HESTIA/data/templates/web/php-fpm/no-php.tpl
-
-    # Update  socket template
-    cp -f $HESTIA_INSTALL_DIR/templates/web/php-fpm/socket.tpl \
-        $HESTIA/data/templates/web/php-fpm/socket.tpl
-
-    for version in $($HESTIA/bin/v-list-sys-php plain); do 
-        echo "[ * ] Updating templates for PHP ${version}..."
-        cp -f $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl \
-            $HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl; 
-    done
-}
-
 upgrade_get_version() {
     # Retrieve new version number for Hestia Control Panel from .deb package
     new_version=$(dpkg -l | awk '$2=="hestia" { print $3 }')
@@ -261,6 +357,7 @@ upgrade_rebuild_users() {
         if [ ! -z "$MAIL_SYSTEM" ]; then 
             $BIN/v-rebuild-mail-domains $user 'no' >/dev/null 2>&1
         fi
+        $BIN/v-rebuild-user $user 'no' >/dev/null 2>&1
     done
 }
 

+ 1 - 1
install/deb/apache2/apache2.conf

@@ -80,7 +80,7 @@ LogFormat "%{Referer}i -> %U" referer
 LogFormat "%{User-agent}i" agent
 LogFormat "%b" bytes
 
-Include conf.d/
+Include conf.d/*.conf
 IncludeOptional conf.d/domains/*.conf
 
 # Include the virtual host configurations:

+ 1 - 1
install/deb/filemanager/filegator/backend/Services/Auth/Adapters/HestiaAuth.php

@@ -59,7 +59,7 @@ class HestiaAuth implements Service, AuthInterface
     {
         $user = new User();
         $user->setUsername($this->hestia_user);
-        $user->setName($this->hestia_user . " (" . $hstuser['FNAME'] . " " . $hstuser['LNAME'] . ")");
+        $user->setName($this->hestia_user . " (" . $hstuser['NAME']. ")");
         $user->setRole('user');
         $user->setPermissions($this->permissions);
         $user->setHomedir('/');

+ 2 - 2
install/deb/nginx/phpmyadmin.inc

@@ -6,14 +6,14 @@ location /%pma_alias% {
         return 404;
     }
 
-    location ~ ^/phpmyadmin/(.*\.php)$ {
+    location ~ ^/%pma_alias%/(.*\.php)$ {
         alias /usr/share/phpmyadmin/$1;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;
         include fastcgi_params;
         fastcgi_param SCRIPT_FILENAME $request_filename;
     }
-    location /phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
+    location /%pma_alias%/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
         root /usr/share/phpmyadmin/;
     }
 }

+ 1 - 1
install/deb/nginx/phppgadmin.inc

@@ -1,7 +1,7 @@
 location /%pga_alias% {
     alias /usr/share/phppgadmin/;
 
-    location ~ ^/phppgadmin/(.*\.php)$ {
+    location ~ ^/%pga_alias%/(.*\.php)$ {
         alias /usr/share/phppgadmin/$1;
         fastcgi_pass 127.0.0.1:9000;
         fastcgi_index index.php;

+ 5 - 0
install/deb/templates/web/apache2/default.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_ssl_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/default.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/hosting.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_ssl_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/hosting.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/php-fpm/default.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_ssl_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/php-fpm/default.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/phpcgi.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_ssl_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/phpcgi.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/phpfcgid.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_ssl_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/apache2/phpfcgid.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 <VirtualHost %ip%:%web_port%>
 
     ServerName %domain_idn%

+ 5 - 0
install/deb/templates/web/nginx/caching.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/caching.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/default.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/default.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/hosting.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/hosting.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%proxy_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/cms_made_simple.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/cms_made_simple.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/codeigniter2.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/codeigniter2.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/codeigniter3.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/codeigniter3.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/datalife_engine.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/datalife_engine.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/default.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/default.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/dokuwiki.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/dokuwiki.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 90 - 0
install/deb/templates/web/nginx/php-fpm/drupal-composer.stpl

@@ -0,0 +1,90 @@
+server {
+    listen      %ip%:%web_ssl_port% ssl http2;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/web;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    ssl_certificate      %ssl_pem%;
+    ssl_certificate_key  %ssl_key%;
+    ssl_stapling on;
+    ssl_stapling_verify on;
+
+    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}
+

+ 86 - 0
install/deb/templates/web/nginx/php-fpm/drupal-composer.tpl

@@ -0,0 +1,86 @@
+server {
+    listen      %ip%:%web_port%;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/web;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}
+

+ 90 - 0
install/deb/templates/web/nginx/php-fpm/drupal-social.stpl

@@ -0,0 +1,90 @@
+server {
+    listen      %ip%:%web_ssl_port% ssl http2;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/html;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    ssl_certificate      %ssl_pem%;
+    ssl_certificate_key  %ssl_key%;
+    ssl_stapling on;
+    ssl_stapling_verify on;
+
+    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}
+

+ 86 - 0
install/deb/templates/web/nginx/php-fpm/drupal-social.tpl

@@ -0,0 +1,86 @@
+server {
+    listen      %ip%:%web_port%;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/html;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}
+

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/drupal6.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/drupal6.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 43 - 30
install/deb/templates/web/nginx/php-fpm/drupal7.stpl

@@ -1,7 +1,12 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;
-    root        %sdocroot%;
+    root        %docroot%;
     index       index.php index.html index.htm;
     access_log  /var/log/nginx/domains/%domain%.log combined;
     access_log  /var/log/nginx/domains/%domain%.bytes bytes;
@@ -25,62 +30,69 @@ server {
         access_log off;
     }
 
-    location ~* \.(txt|log)$ {
-        allow 192.168.0.0/16;
+    location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
         deny all;
+        return 404;
     }
 
     location ~ \..*/.*\.php$ {
-        return 403;
+        deny all;
+        return 404;
     }
 
     location ~ ^/sites/.*/private/ {
-        return 403;
+        deny all;
+        return 404;
     }
 
     location ~ ^/sites/[^/]+/files/.*\.php$ {
         deny all;
-    }
-    
-    location / {
-        try_files $uri /index.php?$query_string;
+        return 404;
     }
 
     location ~ /vendor/.*\.php$ {
         deny all;
         return 404;
-    }        
-
-    location ~ ^/sites/.*/files/styles/ {
-        try_files $uri @rewrite;
     }
 
-    location ~ ^(/[a-z\-]+)?/system/files/ {
-        try_files $uri /index.php?$query_string;
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
     }
 
-    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
-        try_files $uri @rewrite;
-        expires max;
-        log_not_found off;
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
     }
-    
-    location ~ '\.php$|^/update.php' {
-        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_pass %backend_lsnr%;
-        include         /etc/nginx/fastcgi_params;
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
     }
 
+    rewrite ^/index.php/(.*) /$1 permanent;
+
     location /error/ {
         alias   %home%/%user%/web/%domain%/document_errors/;
     }
 
-    location ~* "/\.(htaccess|htpasswd)$" {
-        deny    all;
-        return  404;
-    }
-
     location /vstats/ {
         alias   %home%/%user%/web/%domain%/stats/;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
@@ -90,3 +102,4 @@ server {
     include     /etc/nginx/conf.d/phppgadmin.inc*;
     include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
 }
+

+ 43 - 30
install/deb/templates/web/nginx/php-fpm/drupal7.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;
@@ -20,62 +25,69 @@ server {
         access_log off;
     }
 
-    location ~* \.(txt|log)$ {
-        allow 192.168.0.0/16;
+    location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
         deny all;
+        return 404;
     }
 
     location ~ \..*/.*\.php$ {
-        return 403;
-        }
+        deny all;
+        return 404;
+    }
 
     location ~ ^/sites/.*/private/ {
-        return 403;
+        deny all;
+        return 404;
     }
-    
+
     location ~ ^/sites/[^/]+/files/.*\.php$ {
         deny all;
-    }
-    
-    location / {
-        try_files $uri /index.php?$query_string;
+        return 404;
     }
 
     location ~ /vendor/.*\.php$ {
         deny all;
         return 404;
-    }        
-
-    location ~ ^/sites/.*/files/styles/ {
-        try_files $uri @rewrite;
     }
 
-    location ~ ^(/[a-z\-]+)?/system/files/ {
-        try_files $uri /index.php?$query_string;
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
     }
 
-    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
-        try_files $uri @rewrite;
-        expires max;
-        log_not_found off;
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
     }
 
-    location ~ '\.php$|^/update.php' {
-        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_pass %backend_lsnr%;
-        include         /etc/nginx/fastcgi_params;
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
     }
 
+    rewrite ^/index.php/(.*) /$1 permanent;
+
     location /error/ {
         alias   %home%/%user%/web/%domain%/document_errors/;
     }
 
-    location ~* "/\.(htaccess|htpasswd)$" {
-        deny    all;
-        return  404;
-    }
-
     location /vstats/ {
         alias   %home%/%user%/web/%domain%/stats/;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
@@ -85,3 +97,4 @@ server {
     include     /etc/nginx/conf.d/phppgadmin.inc*;
     include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
 }
+

+ 43 - 30
install/deb/templates/web/nginx/php-fpm/drupal8.stpl

@@ -1,7 +1,12 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;
-    root        %sdocroot%;
+    root        %docroot%;
     index       index.php index.html index.htm;
     access_log  /var/log/nginx/domains/%domain%.log combined;
     access_log  /var/log/nginx/domains/%domain%.bytes bytes;
@@ -25,62 +30,69 @@ server {
         access_log off;
     }
 
-    location ~* \.(txt|log)$ {
-        allow 192.168.0.0/16;
+    location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
         deny all;
+        return 404;
     }
 
     location ~ \..*/.*\.php$ {
-        return 403;
+        deny all;
+        return 404;
     }
 
     location ~ ^/sites/.*/private/ {
-        return 403;
+        deny all;
+        return 404;
     }
 
     location ~ ^/sites/[^/]+/files/.*\.php$ {
         deny all;
-    }
-    
-    location / {
-        try_files $uri /index.php?$query_string;
+        return 404;
     }
 
     location ~ /vendor/.*\.php$ {
         deny all;
         return 404;
-    }        
-
-    location ~ ^/sites/.*/files/styles/ {
-        try_files $uri @rewrite;
     }
 
-    location ~ ^(/[a-z\-]+)?/system/files/ {
-        try_files $uri /index.php?$query_string;
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
     }
 
-    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
-        try_files $uri @rewrite;
-        expires max;
-        log_not_found off;
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
     }
-    
-    location ~ '\.php$|^/update.php' {
-        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_pass %backend_lsnr%;
-        include         /etc/nginx/fastcgi_params;
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
     }
 
+    rewrite ^/index.php/(.*) /$1 permanent;
+
     location /error/ {
         alias   %home%/%user%/web/%domain%/document_errors/;
     }
 
-    location ~* "/\.(htaccess|htpasswd)$" {
-        deny    all;
-        return  404;
-    }
-
     location /vstats/ {
         alias   %home%/%user%/web/%domain%/stats/;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
@@ -90,3 +102,4 @@ server {
     include     /etc/nginx/conf.d/phppgadmin.inc*;
     include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
 }
+

+ 45 - 31
install/deb/templates/web/nginx/php-fpm/drupal8.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;
@@ -6,7 +11,7 @@ server {
     access_log  /var/log/nginx/domains/%domain%.log combined;
     access_log  /var/log/nginx/domains/%domain%.bytes bytes;
     error_log   /var/log/nginx/domains/%domain%.error.log error;
-        
+
     include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
 
     location = /favicon.ico {
@@ -20,62 +25,70 @@ server {
         access_log off;
     }
 
-    location ~* \.(txt|log)$ {
-        allow 192.168.0.0/16;
+    location ~ /(changelog.txt|copyright.txt|install.mysql.txt|install.pgsql.txt|install.sqlite.txt|install.txt|license.txt|maintainers.txt|license|license.txt|readme.txt|readme.md|upgrade.txt) {
         deny all;
+        return 404;
     }
 
     location ~ \..*/.*\.php$ {
-        return 403;
-        }
+        deny all;
+        return 404;
+    }
 
     location ~ ^/sites/.*/private/ {
-        return 403;
+        deny all;
+        return 404;
     }
-    
+
     location ~ ^/sites/[^/]+/files/.*\.php$ {
         deny all;
-    }
-    
-    location / {
-        try_files $uri /index.php?$query_string;
+        return 404;
     }
 
     location ~ /vendor/.*\.php$ {
         deny all;
         return 404;
-    }        
-
-    location ~ ^/sites/.*/files/styles/ {
-        try_files $uri @rewrite;
     }
 
-    location ~ ^(/[a-z\-]+)?/system/files/ {
-        try_files $uri /index.php?$query_string;
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
     }
 
-    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
-        try_files $uri @rewrite;
-        expires max;
-        log_not_found off;
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
     }
 
-    location ~ '\.php$|^/update.php' {
-        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
-        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-        fastcgi_pass %backend_lsnr%;
-        include         /etc/nginx/fastcgi_params;
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
     }
 
+    rewrite ^/index.php/(.*) /$1 permanent;
+
     location /error/ {
         alias   %home%/%user%/web/%domain%/document_errors/;
     }
 
-    location ~* "/\.(htaccess|htpasswd)$" {
-        deny    all;
-        return  404;
-    }
-
     location /vstats/ {
         alias   %home%/%user%/web/%domain%/stats/;
         include %home%/%user%/web/%domain%/stats/auth.conf*;
@@ -85,3 +98,4 @@ server {
     include     /etc/nginx/conf.d/phppgadmin.inc*;
     include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
 }
+

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/joomla.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/joomla.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/laravel.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/laravel.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/magento.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/magento.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/modx.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/modx.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/moodle.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/moodle.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/no-php.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/no-php.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/odoo.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/odoo.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/opencart.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/opencart.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/owncloud.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/owncloud.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/piwik.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/piwik.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/pyrocms.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/pyrocms.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/sendy.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/sendy.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 90 - 0
install/deb/templates/web/nginx/php-fpm/thunder.stpl

@@ -0,0 +1,90 @@
+server {
+    listen      %ip%:%web_ssl_port% ssl http2;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/docroot;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    ssl_certificate      %ssl_pem%;
+    ssl_certificate_key  %ssl_key%;
+    ssl_stapling on;
+    ssl_stapling_verify on;
+
+    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
+}
+

+ 86 - 0
install/deb/templates/web/nginx/php-fpm/thunder.tpl

@@ -0,0 +1,86 @@
+server {
+    listen      %ip%:%web_port%;
+    server_name %domain_idn% %alias_idn%;
+    root        %docroot%/docroot;
+    index       index.php index.html index.htm;
+    access_log  /var/log/nginx/domains/%domain%.log combined;
+    access_log  /var/log/nginx/domains/%domain%.bytes bytes;
+    error_log   /var/log/nginx/domains/%domain%.error.log error;
+
+    include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
+
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+
+    location ~ \..*/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/.*/private/ {
+        deny all;
+        return 404;
+    }
+
+    location ~ ^/sites/[^/]+/files/.*\.php$ {
+        deny all;
+        return 404;
+    }
+
+    location ~ /\.(?!well-known\/) {
+        deny all;
+        return 404;
+    }
+
+    location / {
+        try_files $uri $uri/ /index.php?$query_string;
+
+        location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
+            try_files $uri @rewrite;
+            expires 30d;
+            fastcgi_hide_header "Set-Cookie";
+        }
+
+        location ~ [^/]\.php(/|$)|^/update.php {
+            fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
+            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+            try_files $uri =404;
+            fastcgi_pass %backend_lsnr%;
+            fastcgi_index index.php;
+            fastcgi_param SCRIPT_FILENAME $request_filename;
+            include /etc/nginx/fastcgi_params;
+        }
+
+        location ~ ^/sites/.*/files/styles/ {
+            try_files $uri @rewrite;
+        }
+    }
+
+    location @rewrite {
+        rewrite ^/(.*)$ /index.php?q=$1;
+    }
+
+    rewrite ^/index.php/(.*) /$1 permanent;
+
+    location /error/ {
+        alias   %home%/%user%/web/%domain%/document_errors/;
+    }
+
+    location /vstats/ {
+        alias   %home%/%user%/web/%domain%/stats/;
+        include %home%/%user%/web/%domain%/stats/auth.conf*;
+    }
+
+    include     /etc/nginx/conf.d/phpmyadmin.inc*;
+    include     /etc/nginx/conf.d/phppgadmin.inc*;
+    include     %home%/%user%/conf/web/%domain%/nginx.conf_*;
+}
+

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/wordpress.stpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_ssl_port% ssl http2;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/wordpress.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen      %ip%:%web_port%;
     server_name %domain_idn% %alias_idn%;

+ 5 - 0
install/deb/templates/web/nginx/proxy_ip.tpl

@@ -1,3 +1,8 @@
+#=======================================================================#
+# Default Web Domain Template                                           #
+# DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
+#=======================================================================#
+
 server {
     listen       %ip%:%proxy_port% default;
     server_name  _;

+ 7 - 15
install/hst-install-debian.sh

@@ -23,7 +23,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
 VERBOSE='no'
 
 # Define software versions
-HESTIA_INSTALL_VER='1.2.0'
+HESTIA_INSTALL_VER='1.2.2'
 pma_v='5.0.2'
 multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4")
 fpm_v="7.3"
@@ -41,7 +41,7 @@ if [ "$release" -eq 9 ]; then
         dovecot-pop3d roundcube-core net-tools roundcube-mysql roundcube-plugins
         mariadb-client mariadb-common mariadb-server postgresql
         postgresql-contrib phppgadmin phpmyadmin mc flex whois rssh git idn zip
-        sudo bc ftp lsof ntpdate rrdtool quota e2fslibs bsdutils e2fsprogs curl
+        sudo bc ftp lsof rrdtool quota e2fslibs bsdutils e2fsprogs curl
         imagemagick fail2ban dnsutils bsdmainutils cron hestia hestia-nginx
         hestia-php expect libmail-dkim-perl unrar-free vim-common acl sysstat
         rsyslog ssh setpriv ipset libapache2-mod-ruid2"
@@ -57,7 +57,7 @@ elif [ "$release" -eq 10 ]; then
         clamav-daemon spamassassin dovecot-imapd dovecot-pop3d roundcube-core
         net-tools roundcube-mysql roundcube-plugins mariadb-client
         mariadb-common mariadb-server postgresql postgresql-contrib phpmyadmin
-        phppgadmin mc flex whois git idn zip sudo bc ftp lsof ntpdate rrdtool
+        phppgadmin mc flex whois git idn zip sudo bc ftp lsof rrdtool
         quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
         bsdmainutils cron hestia hestia-nginx hestia-php expect
         libmail-dkim-perl unrar-free vim-common acl sysstat rsyslog ssh util-linux
@@ -310,13 +310,6 @@ apt-get -qq update
 # Creating backup directory
 mkdir -p $hst_backups
 
-# Checking ntpdate
-if [ ! -e '/usr/sbin/ntpdate' ]; then
-    echo "[ * ] Installing ntpdate..."
-    apt-get -y install ntpdate >> $LOG
-    check_result $? "Can't install ntpdate"
-fi
-
 # Checking wget
 if [ ! -e '/usr/bin/wget' ]; then
     echo "[ * ] Installing wget..."
@@ -965,10 +958,9 @@ if [ -z "$(grep ^/usr/sbin/nologin /etc/shells)" ]; then
 fi
 
 # Configuring NTP
-echo '#!/bin/sh' > /etc/cron.daily/ntpdate
-echo "$(which ntpdate) -s pool.ntp.org" >> /etc/cron.daily/ntpdate
-chmod 755 /etc/cron.daily/ntpdate
-ntpdate -s pool.ntp.org
+sed -i 's/#NTP=/NTP=pool.ntp.org/' /etc/systemd/timesyncd.conf
+systemctl enable systemd-timesyncd
+systemctl start systemd-timesyncd
 
 # Setup rssh
 if [ ! "$release" -eq 10 ]; then
@@ -1766,7 +1758,7 @@ $HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
 check_result $? "can't enable sftp jail"
 
 # Adding Hestia admin account
-$HESTIA/bin/v-add-user admin $vpass $email default System Administrator
+$HESTIA/bin/v-add-user admin $vpass $email default "System Administrator"
 check_result $? "can't create admin user"
 $HESTIA/bin/v-change-user-shell admin nologin
 $HESTIA/bin/v-change-user-language admin $lang

+ 6 - 14
install/hst-install-ubuntu.sh

@@ -23,7 +23,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
 VERBOSE='no'
 
 # Define software versions
-HESTIA_INSTALL_VER='1.2.0'
+HESTIA_INSTALL_VER='1.2.2'
 pma_v='5.0.2'
 multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4")
 fpm_v="7.3"
@@ -35,7 +35,7 @@ software="apache2 apache2.2-common apache2-suexec-custom apache2-utils
     cron curl dnsutils dovecot-imapd dovecot-pop3d e2fslibs e2fsprogs exim4
     exim4-daemon-heavy expect fail2ban flex ftp git idn imagemagick
     libapache2-mod-fcgid libapache2-mod-php$fpm_v libapache2-mod-rpaf
-    lsof mc mariadb-client mariadb-common mariadb-server nginx ntpdate
+    lsof mc mariadb-client mariadb-common mariadb-server nginx
     php$fpm_v php$fpm_v-cgi php$fpm_v-common php$fpm_v-curl phpmyadmin
     php$fpm_v-mysql php$fpm_v-imap php$fpm_v-ldap php$fpm_v-apcu phppgadmin
     php$fpm_v-pgsql php$fpm_v-zip php$fpm_v-bz2 php$fpm_v-cli php$fpm_v-gd
@@ -292,13 +292,6 @@ apt-get -qq update
 # Creating backup directory
 mkdir -p $hst_backups
 
-# Checking ntpdate
-if [ ! -e '/usr/sbin/ntpdate' ]; then
-    echo "[ * ] Installing ntpdate..."
-    apt-get -y install ntpdate >> $LOG
-    check_result $? "Can't install ntpdate"
-fi
-
 # Checking wget
 if [ ! -e '/usr/bin/wget' ]; then
     echo "[ * ] Installing wget..."
@@ -959,10 +952,9 @@ if [ -z "$(grep nologin /etc/shells)" ]; then
 fi
 
 # Configuring NTP
-echo '#!/bin/sh' > /etc/cron.daily/ntpdate
-echo "$(which ntpdate) -s pool.ntp.org" >> /etc/cron.daily/ntpdate
-chmod 755 /etc/cron.daily/ntpdate
-ntpdate -s pool.ntp.org
+sed -i 's/#NTP=/NTP=pool.ntp.org/' /etc/systemd/timesyncd.conf
+systemctl enable systemd-timesyncd
+systemctl start systemd-timesyncd
 
 # Setup rssh
 if [ "$release" != '20.04' ]; then
@@ -1765,7 +1757,7 @@ $HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
 check_result $? "can't enable sftp jail"
 
 # Adding Hestia admin account
-$HESTIA/bin/v-add-user admin $vpass $email default System Administrator
+$HESTIA/bin/v-add-user admin $vpass $email default "System Administrator"
 check_result $? "can't create admin user"
 $HESTIA/bin/v-change-user-shell admin nologin
 $HESTIA/bin/v-change-user-language admin $lang

+ 10 - 199
install/upgrade/versions/latest.sh

@@ -1,206 +1,17 @@
 #!/bin/sh
 
-# Hestia Control Panel upgrade script for target version 1.2.0
+# Hestia Control Panel upgrade script for target version 1.2.2
 
 #######################################################################################
 #######                      Place additional commands below.                   #######
 #######################################################################################
 
-# Check iptables paths and add symlinks when necessary
-
-if [ ! -e "/sbin/iptables" ]; then
-    if which iptables; then
-        ln -s "$(which iptables)" /sbin/iptables
-    elif [ -e "/usr/sbin/iptables" ]; then
-        ln -s /usr/sbin/iptables /sbin/iptables
-    elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables; then
-        autoiptables=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables | cut -d '' -f 2)
-        if [ -x "$autoiptables" ]; then
-            ln -s "$autoiptables" /sbin/iptables
-        fi
-    fi
-fi
-
-if [ ! -e "/sbin/iptables-save" ]; then
-    if which iptables-save; then
-        ln -s "$(which iptables-save)" /sbin/iptables-save
-    elif [ -e "/usr/sbin/iptables-save" ]; then
-        ln -s /usr/sbin/iptables-save /sbin/iptables-save
-    elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-save; then
-        autoiptables_save=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-save | cut -d '' -f 2)
-        if [ -x "$autoiptables_save" ]; then
-            ln -s "$autoiptables_save" /sbin/iptables-save
-        fi
-    fi
-fi
-
-if [ ! -e "/sbin/iptables-restore" ]; then
-    if which iptables-restore; then
-        ln -s "$(which iptables-restore)" /sbin/iptables-restore
-    elif [ -e "/usr/sbin/iptables-restore" ]; then
-        ln -s /usr/sbin/iptables-restore /sbin/iptables-restore
-    elif whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-restore; then
-        autoiptables_restore=$(whereis -B /bin /sbin /usr/bin /usr/sbin -f -b iptables-restore | cut -d '' -f 2)
-        if [ -x "$autoiptables_restore" ]; then
-            ln -s "$autoiptables_restore" /sbin/iptables-restore
-        fi
-    fi
-fi
-
-if [ -e "/etc/apache2/mods-enabled/status.conf" ]; then
-    sed -i '/Allow from all/d' /etc/apache2/mods-enabled/status.conf
-fi
-
-# Add sury apache2 repository
-if [ "$WEB_SYSTEM" = "apache2" ] && [ ! -e "/etc/apt/sources.list.d/apache2.list" ]; then
-    echo "[ * ] Configuring sury.org Apache2 repository..."
-
-    # Check OS and install related repository
-    if [ -e "/etc/os-release" ]; then
-        type=$(grep "^ID=" /etc/os-release | cut -f 2 -d '=')
-        if [ "$type" = "ubuntu" ]; then
-            codename="$(lsb_release -s -c)"
-            echo "deb http://ppa.launchpad.net/ondrej/apache2/ubuntu $codename main" > /etc/apt/sources.list.d/apache2.list
-        elif [ "$type" = "debian" ]; then
-            codename="$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))"
-            echo "deb https://packages.sury.org/apache2/ $codename main" > /etc/apt/sources.list.d/apache2.list
-            wget --quiet https://packages.sury.org/apache2/apt.gpg -O /tmp/apache2_signing.key
-            APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/apache2_signing.key > /dev/null 2>&1
-        fi
-    fi
-fi
-
-# Roundcube fixes for PHP 7.4 compatibility
-if [ -d /usr/share/roundcube ]; then
-    echo "[ * ] Updating Roundcube configuration..."
-    [ -f "/usr/share/roundcube/plugins/enigma/lib/enigma_ui.php" ] && sed -i 's/$identities, "\\n"/"\\n", $identities/g' /usr/share/roundcube/plugins/enigma/lib/enigma_ui.php
-    [ -f "/usr/share/roundcube/program/lib/Roundcube/rcube_contacts.php" ] && sed -i 's/(array_keys($post_search), \x27|\x27)/(\x27|\x27, array_keys($post_search))/g' /usr/share/roundcube/program/lib/Roundcube/rcube_contacts.php
-    [ -f "/usr/share/roundcube/program/lib/Roundcube/rcube_db.php" ] && sed -i 's/implode($name, \x27.\x27)/implode(\x27.\x27, $name)/g' /usr/share/roundcube/program/lib/Roundcube/rcube_db.php
-    [ -f "/usr/share/roundcube/program/steps/addressbook/search.inc" ] && sed -i 's/$fields, \x27,\x27/\x27,\x27, $fields/g' /usr/share/roundcube/program/steps/addressbook/search.inc
-    [ -f "/usr/share/roundcube/program/steps/addressbook/search.inc" ] && sed -i 's/implode($fields, \x27,\x27)/implode(\x27,\x27, $fields)/g' /usr/share/roundcube/program/steps/addressbook/search.inc
-    [ -f "/usr/share/roundcube/program/steps/mail/sendmail.inc" ] && sed -i 's/implode($bstyle, \x27; \x27)/implode(\x27; \x27, $bstyle)/g' /usr/share/roundcube/program/steps/mail/sendmail.inc
-fi
-
-# Enable Roundcube plugins
-if [ -d /usr/share/roundcube ]; then
-    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_newmail_notifier.inc.php /etc/roundcube/plugins/newmail_notifier/config.inc.php
-    cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_zipdownload.inc.php /etc/roundcube/plugins/zipdownload/config.inc.php
-    [ -f "/etc/roundcube/config.inc.php" ] && sed -i "s/array('password')/array('password','newmail_notifier','zipdownload')/g" /etc/roundcube/config.inc.php
-fi
-
-# HELO support for multiple domains and IPs
-if [ -e "/etc/exim4/exim4.conf.template" ]; then
-    echo "[ * ] Updating exim4 configuration..."
-    sed -i 's|helo_data = ${primary_hostname}|helo_data = ${if exists {\/etc\/exim4\/mailhelo.conf}{${lookup{$sender_address_domain}lsearch*{\/etc\/exim4\/mailhelo.conf}{$value}{$primary_hostname}}}{$primary_hostname}}|g' /etc/exim4/exim4.conf.template
-fi
-
-# Add daily midnight cron
-if [ -z "$($BIN/v-list-cron-jobs admin | grep 'v-update-sys-queue daily')" ]; then
-    echo "[ * ] Updating cron jobs..."
-    command="sudo $BIN/v-update-sys-queue daily"
-    $BIN/v-add-cron-job 'admin' '01' '00' '*' '*' '*' "$command"
-fi
-[ ! -f "touch $HESTIA/data/queue/daily.pipe" ] && touch $HESTIA/data/queue/daily.pipe
-
-# Remove existing network-up hooks so they get regenerated when updating the firewall
-# - network hook will also restore ipset config during start-up
-if [ -f "/usr/lib/networkd-dispatcher/routable.d/50-ifup-hooks" ]; then
-    rm "/usr/lib/networkd-dispatcher/routable.d/50-ifup-hooks"
-    $BIN/v-update-firewall
-fi
-if [ -f "/etc/network/if-pre-up.d/iptables" ];then
-    rm "/etc/network/if-pre-up.d/iptables"
-    $BIN/v-update-firewall
-fi
-
-# Add hestia-event.conf, if the server is running apache2
-if [ "$WEB_SYSTEM" = "apache2" ]; then
-    echo "[ * ] Updating Apache2 configuration..."
-    # Cleanup
-    rm --force /etc/apache2/mods-available/hestia-event.conf
-    rm --force /etc/apache2/mods-enabled/hestia-event.conf
-    rm --force /etc/apache2/conf-available/hestia-event.conf
-    rm --force /etc/apache2/conf-enabled/hestia-event.conf
-
-    if [ $(a2query -M) = 'event' ] && [ ! -e "/etc/apache2/conf.d/hestia-event.conf" ]; then
-        cp -f $HESTIA_INSTALL_DIR/apache2/hestia-event.conf /etc/apache2/conf.d/
-    fi
-
-    # Move apache mod_status config to /mods-available and rename it to prevent losing changes on upgrade
-    cp -f $HESTIA_INSTALL_DIR/apache2/status.conf /etc/apache2/mods-available/hestia-status.conf
-    cp -f /etc/apache2/mods-available/status.load /etc/apache2/mods-available/hestia-status.load
-    a2dismod --quiet status > /dev/null 2>&1
-    a2enmod --quiet hestia-status > /dev/null 2>&1
-    rm --force /etc/apache2/mods-enabled/status.conf # a2dismod will not remove the file if it isn't a symlink
-fi
-
-# Install File Manager during upgrade if environment variable oesn't already exist and isn't set to false
-# so that we don't override preference
-FILE_MANAGER_CHECK=$(cat $HESTIA/conf/hestia.conf | grep "FILE_MANAGER='false'")
-if [ -z "$FILE_MANAGER_CHECK" ]; then
-    if [ ! -e "$HESTIA/web/fm/configuration.php" ]; then
-        echo "[ ! ] Installing File Manager..."
-        # Install the File Manager
-        $HESTIA/bin/v-add-sys-filemanager quiet
-    else 
-        echo "[ * ] Updating File Manager configuration..."
-        # Update configuration.php
-        cp -f $HESTIA_INSTALL_DIR/filemanager/filegator/configuration.php $HESTIA/web/fm/configuration.php
-        # Set environment variable for interface
-        $HESTIA/bin/v-change-sys-config-value 'FILE_MANAGER' 'true'
-    fi
-fi
-
-# Enable nginx module loading
-if [ -f "/etc/nginx/nginx.conf" ]; then
-    echo "[ * ] Updating NGINX configuration..."
-    if [ ! -d "/etc/nginx/modules-enabled" ]; then
-        mkdir -p "/etc/nginx/modules-enabled"
-    fi
-
-    if ! grep --silent "include /etc/nginx/modules-enabled" /etc/nginx/nginx.conf; then
-        sed -i '/^pid/ a include /etc/nginx/modules-enabled/*.conf;' /etc/nginx/nginx.conf
-    fi
-fi
-
-# Fix public_(s)html group ownership
-echo "[ * ] Updating public_(s)html ownership..."
-for user in $($HESTIA/bin/v-list-sys-users plain); do
-    # skip users with missing home folder
-    [[ -d /home/${user}/ ]] || continue
-
-    # skip users without web domains
-    ls /home/${user}/web/*/public_*html >/dev/null 2>&1 || continue
-
-    chown --silent --no-dereference :www-data /home/$user/web/*/public_*html
-done
-
-# Fix phpMyAdmin blowfish_secret error message due to incorrect permissions
-if [ -e /var/lib/phpmyadmin/blowfish_secret.inc.php ]; then
-    echo "[ * ] Updating phpMyAdmin permissions..."
-    chmod 0644 /var/lib/phpmyadmin/blowfish_secret.inc.php
-fi
-
-# Add phpMyAdmin/phpPgAdmin aliases to hestia.conf and correct configuration/templates
-if [ -e "/var/lib/phpmyadmin" ]; then
-PMA_ALIAS_CHECK=$(cat $HESTIA/conf/hestia.conf | grep DB_PMA_ALIAS)
-    if [ -z "$PMA_ALIAS_CHECK" ]; then
-        echo "[ * ] Updating phpMyAdmin alias..."
-        $HESTIA/bin/v-change-sys-db-alias "pma" "phpmyadmin"
-    fi
-fi
-
-if [ -e "/var/lib/phppgadmin" ]; then
-PGA_ALIAS_CHECK=$(cat $HESTIA/conf/hestia.conf | grep DB_PGA_ALIAS)
-    if [ -z "$PGA_ALIAS_CHECK" ]; then
-        echo "[ * ] Updating phpPgAdmin alias..."
-        $HESTIA/bin/v-change-sys-db-alias "pga" "phppgadmin"
-    fi
-fi
-
-# Ensure that backup compression level is correctly set
-GZIP_LVL_CHECK=$(cat $HESTIA/conf/hestia.conf | grep BACKUP_GZIP)
-if [ -z "$GZIP_LVL_CHECK" ]; then
-    echo "[ * ] Updating backup compression level variable..."
-    $BIN/v-change-sys-config-value "BACKUP_GZIP" '9'
-fi
+# Update template files to add warnings
+# Backup current templates
+cp -r -f $HESTIA/data/templates/* $HESTIA_BACKUP/templates/
+echo "[ ! ] Updating default web domain templates..."
+$BIN/v-update-web-templates
+echo "[ ! ] Updating default mail domain templates..."
+$BIN/v-update-mail-templates
+echo "[ ! ] Updating default DNS zone templates..."
+$BIN/v-update-dns-templates

Some files were not shown because too many files changed in this diff