@@ -67,22 +67,43 @@ for domain in $domains; do
6767 aliases=$( get_web_domain_value ' $ALIAS' )
6868 aliases_idn=$( idn -t --quiet -a " $aliases " )
6969
70- # ssl_cert=$()
71- # ssl_key=$()
72-
7370 # Adding domain to the tmp_httpd.conf
7471 conf=" $V_HOME /$user /conf/tmp_httpd.conf"
7572 httpd_add_config
7673
7774 # Running template trigger
78- if [ -e $V_WEBTPL /apache_$template .sh ]; then
75+ if [ -x $V_WEBTPL /apache_$template .sh ]; then
7976 $V_WEBTPL /apache_$template .sh $user $domain $ip $V_HOME $docroot $port
8077 fi
8178
79+ # Checking ssl
80+ ssl=$( get_web_domain_value ' $SSL' )
81+ if [ " $ssl " = ' yes' ]; then
82+ # Parsing certificate params
83+ cert=$( get_web_domain_value ' $SSL_CERT' )
84+ ssl_cert=" $V_HOME /$user /conf/$cert .crt"
85+ ssl_key=" $V_HOME /$user /conf/$cert .key"
86+ tpl_option=$( get_web_domain_value ' $SSL_HOME' )
87+ case $tpl_option in
88+ single) docroot=" $V_HOME /$user /domains/$domain /public_shtml" ;;
89+ same) docroot=" $V_HOME /$user /domains/$domain /public_html" ;;
90+ * ) check_args ' 3' " $# " ' user domain certificate [sslhome]'
91+ esac
92+
93+ # Adding domain to the httpd.conf
94+ conf=" $V_HOME /$user /conf/tmp_shttpd.conf"
95+ tpl_file=" $V_WEBTPL /apache_$template .stpl"
96+ httpd_add_config
97+
98+ if [ -x $V_WEBTPL /apache_$template .sh ]; then
99+ $V_WEBTPL /apache_$template .sh $user $domain $ip $V_HOME \
100+ $docroot $port
101+ fi
102+ fi
82103done
83104
84105# Renaming tmp config
85- tmp_conf=" $conf "
106+ tmp_conf=" $V_HOME / $user /conf/tmp_httpd. conf"
86107conf=" $V_HOME /$user /conf/httpd.conf"
87108mv $tmp_conf $conf
88109
@@ -93,7 +114,18 @@ if [ -z "$main_conf_check" ]; then
93114 echo " Include $conf " >> $main_conf
94115fi
95116
96- exit
117+ # Checking ssl
118+ if [ ! -z " $ssl_cert " ]; then
119+ tmp_conf=" $V_HOME /$user /conf/tmp_shttpd.conf"
120+ conf=" $V_HOME /$user /conf/shttpd.conf"
121+ mv $tmp_conf $conf
122+
123+ # Checking include in main httpd.conf
124+ main_conf_check=$( grep " $conf " $main_conf )
125+ if [ -z " $main_conf_check " ]; then
126+ echo " Include $conf " >> $main_conf
127+ fi
128+ fi
97129
98130
99131# ----------------------------------------------------------#
0 commit comments