Skip to content

Commit 7ef3237

Browse files
author
Kristan Kenney
committed
Update templates for proper vhost configuration
1 parent 503d3fe commit 7ef3237

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

func/domain.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ add_webmail_config() {
604604
sed -e "s|%ip%|$local_ip|g" \
605605
-e "s|%domain%|$WEBMAIL_ALIAS.$domain|g" \
606606
-e "s|%domain_idn%|$domain_idn|g" \
607+
-e "s|%webmail_alias%|$WEBMAIL_ALIAS|g" \
607608
-e "s|%alias%|${aliases//,/ }|g" \
608609
-e "s|%alias_idn%|${aliases_idn//,/ }|g" \
609610
-e "s|%alias_string%|$alias_string|g" \
@@ -646,7 +647,7 @@ add_webmail_config() {
646647
rm -rf $HOMEDIR/$user/conf/mail/ssl.$domain.*
647648
rm -rf $HOMEDIR/$user/conf/mail/*nginx.$domain.*
648649
else
649-
rm -f /etc/$1/conf.d/domains/mail.$domain.conf
650+
rm -f /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
650651
if [ ! -z "$WEB_SYSTEM" ]; then
651652
ln -s $conf /etc/$1/conf.d/domains/$WEBMAIL_ALIAS.$domain.conf
652653
fi
@@ -657,10 +658,6 @@ add_webmail_config() {
657658
# Clear old configurations
658659
rm -rf $HOMEDIR/$user/conf/mail/$domain.*
659660
fi
660-
661-
if [ "$1" != 'nginx' ]; then
662-
find /etc/$1/conf.d/domains -type f -name "$domain.*" | xargs sed -i "s/;//g"
663-
fi
664661
}
665662

666663
# Add mail server SSL configuration
@@ -740,14 +737,28 @@ del_mail_ssl_config() {
740737
rm -f /usr/local/hestia/ssl/mail/mail.$domain.*
741738
}
742739

740+
# Delete webmail support
743741
del_webmail_config() {
744742
if [ ! -z "$WEB_SYSTEM" ]; then
745743
rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM*.conf
746744
fi
745+
747746
if [ ! -z "$PROXY_SYSTEM" ]; then
748747
rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM*.conf
749748
fi
750749
}
750+
751+
# Delete SSL webmail support
752+
del_webmail_ssl_config() {
753+
if [ ! -z "$WEB_SYSTEM" ]; then
754+
rm -f $HOMEDIR/$user/conf/mail/$domain/$WEB_SYSTEM.ssl.conf
755+
fi
756+
757+
if [ ! -z "$PROXY_SYSTEM" ]; then
758+
rm -f $HOMEDIR/$user/conf/mail/$domain/$PROXY_SYSTEM.ssl.conf
759+
fi
760+
}
761+
751762
#----------------------------------------------------------#
752763
# CMN #
753764
#----------------------------------------------------------#

install/deb/templates/mail/apache2/default.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<VirtualHost %ip%:%web_ssl_port%>
2-
ServerName %webmail_vhost%
2+
ServerName %webmail_alias%.%domain%
33
Alias / /var/lib/roundcube/
44
Alias /error/ %home%/%user%/web/%domain%/document_errors/
55
#SuexecUserGroup %user% %group%

install/deb/templates/mail/apache2/default.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<VirtualHost %ip%:%web_port%>
2-
ServerName %webmail_vhost%
2+
ServerName %webmail_alias%.%domain%
33
Alias / /var/lib/roundcube/
44
Alias /error/ %home%/%user%/web/%domain%/document_errors/
55
#SuexecUserGroup %user% %group%

install/deb/templates/mail/nginx/default.stpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server {
22
listen %ip%:%proxy_ssl_port% ssl http2;
3-
server_name %domain_idn% %alias_idn%;
3+
server_name %webmail_alias%.%domain%;
44
ssl_certificate %ssl_pem%;
55
ssl_certificate_key %ssl_key%;
66
error_log /var/log/%web_system%/domains/%domain%.error.log error;

install/deb/templates/mail/nginx/default.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server {
22
listen %ip%:%proxy_port%;
3-
server_name %webmail_vhost%;
3+
server_name %webmail_alias%.%domain%;
44
55
include %home%/%user%/conf/web/%domain/nginx.forcessl.conf*;
66
location / {

0 commit comments

Comments
 (0)