Просмотр исходного кода

Update templates for proper vhost configuration

Kristan Kenney 7 лет назад
Родитель
Сommit
7ef323796f

+ 16 - 5
func/domain.sh

@@ -604,6 +604,7 @@ add_webmail_config() {
         sed -e "s|%ip%|$local_ip|g" \
             -e "s|%domain%|$WEBMAIL_ALIAS.$domain|g" \
             -e "s|%domain_idn%|$domain_idn|g" \
+            -e "s|%webmail_alias%|$WEBMAIL_ALIAS|g" \
             -e "s|%alias%|${aliases//,/ }|g" \
             -e "s|%alias_idn%|${aliases_idn//,/ }|g" \
             -e "s|%alias_string%|$alias_string|g" \
@@ -646,7 +647,7 @@ add_webmail_config() {
         rm -rf $HOMEDIR/$user/conf/mail/ssl.$domain.*
         rm -rf $HOMEDIR/$user/conf/mail/*nginx.$domain.*
     else
-        rm -f /etc/$1/conf.d/domains/mail.$domain.conf
+        rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
         if [ ! -z "$WEB_SYSTEM" ]; then
             ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
         fi
@@ -657,10 +658,6 @@ add_webmail_config() {
         # Clear old configurations
         rm -rf $HOMEDIR/$user/conf/mail/$domain.*
     fi
-
-    if [ "$1" != 'nginx' ]; then
-        find /etc/$1/conf.d/domains -type f -name "$domain.*"  | xargs sed -i "s/;//g"
-    fi
 }
 
 # Add mail server SSL configuration
@@ -740,14 +737,28 @@ del_mail_ssl_config() {
     rm -f /usr/local/hestia/ssl/mail/mail.$domain.*
 }
 
+# Delete webmail support
 del_webmail_config() {
     if [ ! -z "$WEB_SYSTEM" ]; then 
         rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM*.conf
     fi
+
     if [ ! -z "$PROXY_SYSTEM" ]; then
         rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM*.conf
     fi
 }
+
+# Delete SSL webmail support
+del_webmail_ssl_config() {
+    if [ ! -z "$WEB_SYSTEM" ]; then 
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.ssl.conf
+    fi
+    
+    if [ ! -z "$PROXY_SYSTEM" ]; then
+        rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.ssl.conf
+    fi
+}
+
 #----------------------------------------------------------#
 #                        CMN                               #
 #----------------------------------------------------------#

+ 1 - 1
install/deb/templates/mail/apache2/default.stpl

@@ -1,5 +1,5 @@
 <VirtualHost %ip%:%web_ssl_port%>
-    ServerName %webmail_vhost%
+    ServerName %webmail_alias%.%domain%
     Alias / /var/lib/roundcube/
     Alias /error/ %home%/%user%/web/%domain%/document_errors/
     #SuexecUserGroup %user% %group%

+ 1 - 1
install/deb/templates/mail/apache2/default.tpl

@@ -1,5 +1,5 @@
 <VirtualHost %ip%:%web_port%>
-    ServerName %webmail_vhost%
+    ServerName %webmail_alias%.%domain%
     Alias / /var/lib/roundcube/
     Alias /error/ %home%/%user%/web/%domain%/document_errors/
     #SuexecUserGroup %user% %group%

+ 1 - 1
install/deb/templates/mail/nginx/default.stpl

@@ -1,6 +1,6 @@
 server {
     listen      %ip%:%proxy_ssl_port% ssl http2;
-    server_name %domain_idn% %alias_idn%;
+    server_name %webmail_alias%.%domain%;
     ssl_certificate      %ssl_pem%;
     ssl_certificate_key  %ssl_key%;
     error_log  /var/log/%web_system%/domains/%domain%.error.log error;

+ 1 - 1
install/deb/templates/mail/nginx/default.tpl

@@ -1,6 +1,6 @@
 server {
     listen      %ip%:%proxy_port%;
-    server_name %webmail_vhost%;
+    server_name %webmail_alias%.%domain%;
         
     include %home%/%user%/conf/web/%domain/nginx.forcessl.conf*;
     location / {