mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 02:28:05 -07:00
improving template structure
This commit is contained in:
parent
fce5ddeddf
commit
cd69b7bcdf
23 changed files with 135 additions and 88 deletions
|
@ -1,11 +1,11 @@
|
|||
# Web template check
|
||||
is_apache_template_valid() {
|
||||
t="$WEBTPL/apache_$template.tpl"
|
||||
s="$WEBTPL/apache_$template.stpl"
|
||||
t="$WEBTPL/apache/$template.tpl"
|
||||
s="$WEBTPL/apache/$template.stpl"
|
||||
if [ ! -e $t ] || [ ! -e $s ]; then
|
||||
template='default'
|
||||
t="$WEBTPL/apache_$template.tpl"
|
||||
s="$WEBTPL/apache_$template.stpl"
|
||||
t="$WEBTPL/apache/$template.tpl"
|
||||
s="$WEBTPL/apache/$template.stpl"
|
||||
if [ ! -e $t ] || [ ! -e $s ]; then
|
||||
echo "Error: template $template not found"
|
||||
log_event "$E_NOTEXIST" "$EVENT"
|
||||
|
@ -16,12 +16,12 @@ is_apache_template_valid() {
|
|||
|
||||
# Nginx template check
|
||||
is_nginx_template_valid() {
|
||||
t="$WEBTPL/nginx_$template.tpl"
|
||||
s="$WEBTPL/nginx_$template.stpl"
|
||||
t="$WEBTPL/nginx/$template.tpl"
|
||||
s="$WEBTPL/nginx/$template.stpl"
|
||||
if [ ! -e $t ] || [ ! -e $s ]; then
|
||||
template='default'
|
||||
t="$WEBTPL/nginx_$template.tpl"
|
||||
s="$WEBTPL/nginx_$template.stpl"
|
||||
t="$WEBTPL/nginx/$template.tpl"
|
||||
s="$WEBTPL/nginx/$template.stpl"
|
||||
if [ ! -e $t ] || [ ! -e $s ]; then
|
||||
echo "Error: nginx $template not found"
|
||||
log_event "$E_NOTEXIST" "$EVENT"
|
||||
|
@ -416,7 +416,7 @@ namehost_ip_support() {
|
|||
sed -i "$conf_ins i Listen $ip:$WEB_PORT" $conf
|
||||
|
||||
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
|
||||
cat $WEBTPL/ngingx.ip.tpl | sed -e "s/%ip%/$ip/g" \
|
||||
cat $WEBTPL/nginx/ip.tpl | sed -e "s/%ip%/$ip/g" \
|
||||
-e "s/%web_port%/$WEB_PORT/g" \
|
||||
-e "s/%proxy_port%/$PROXY_PORT/g" >>$nconf
|
||||
|
||||
|
@ -434,8 +434,8 @@ namehost_ip_disable() {
|
|||
sed -i "/Listen $ip:/d" $conf
|
||||
|
||||
if [ "$PROXY_SYSTEM" = 'nginx' ]; then
|
||||
tpl_ln=$(wc -l $WEBTPL/ngingx.ip.tpl | cut -f 1 -d ' ')
|
||||
ip_line=$(grep -n "%ip%" $WEBTPL/ngingx.ip.tpl |head -n1 |\
|
||||
tpl_ln=$(wc -l $WEBTPL/nginx/ip.tpl | cut -f 1 -d ' ')
|
||||
ip_line=$(grep -n "%ip%" $WEBTPL/nginx/ip.tpl |head -n1 |\
|
||||
cut -f 1 -d :)
|
||||
conf_line=$(grep -n -w $ip $nconf|head -n1|cut -f 1 -d :)
|
||||
if [ -z "$tpl_ln" ] || [ -z "$ip_line" ] || [ -z "$conf_line" ]
|
||||
|
|
|
@ -190,15 +190,15 @@ rebuild_web_domain_conf() {
|
|||
|
||||
|
||||
# Adding tmp_httpd.conf
|
||||
tpl_file="$WEBTPL/apache_$TPL.tpl"
|
||||
tpl_file="$WEBTPL/apache/$TPL.tpl"
|
||||
conf="$HOMEDIR/$user/conf/web/tmp_httpd.conf"
|
||||
add_web_config
|
||||
chown root:apache $conf
|
||||
chmod 640 $conf
|
||||
|
||||
# Running template trigger
|
||||
if [ -x $WEBTPL/apache_$TPL.sh ]; then
|
||||
$WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $docroot
|
||||
if [ -x $WEBTPL/apache/$TPL.sh ]; then
|
||||
$WEBTPL/apache/$TPL.sh $user $domain $ip $HOMEDIR $docroot
|
||||
fi
|
||||
|
||||
# Checking aliases
|
||||
|
@ -209,7 +209,7 @@ rebuild_web_domain_conf() {
|
|||
|
||||
# Checking stats
|
||||
if [ ! -z "$STATS" ]; then
|
||||
cat $WEBTPL/$STATS.tpl |\
|
||||
cat $WEBTPL/$STATS/$STATS.tpl |\
|
||||
sed -e "s/%ip%/$ip/g" \
|
||||
-e "s/%web_port%/$WEB_PORT/g" \
|
||||
-e "s/%web_ssl_port%/$WEB_SSL_PORT/g" \
|
||||
|
@ -254,7 +254,7 @@ rebuild_web_domain_conf() {
|
|||
if [ "$SSL" = 'yes' ]; then
|
||||
# Adding domain to the shttpd.conf
|
||||
conf="$HOMEDIR/$user/conf/web/tmp_shttpd.conf"
|
||||
tpl_file="$WEBTPL/apache_$TPL.stpl"
|
||||
tpl_file="$WEBTPL/apache/$TPL.stpl"
|
||||
add_web_config
|
||||
chown root:apache $conf
|
||||
chmod 640 $conf
|
||||
|
@ -271,8 +271,8 @@ rebuild_web_domain_conf() {
|
|||
fi
|
||||
|
||||
# Running template trigger
|
||||
if [ -x $WEBTPL/apache_$TPL.sh ]; then
|
||||
$WEBTPL/apache_$TPL.sh $user $domain $ip $HOMEDIR $sdocroot
|
||||
if [ -x $WEBTPL/apache/$TPL.sh ]; then
|
||||
$WEBTPL/apache/$TPL.sh $user $domain $ip $HOMEDIR $sdocroot
|
||||
fi
|
||||
|
||||
user_ssl=$((user_ssl + 1))
|
||||
|
@ -281,14 +281,14 @@ rebuild_web_domain_conf() {
|
|||
|
||||
# Checking nginx
|
||||
if [ ! -z "$NGINX" ]; then
|
||||
tpl_file="$WEBTPL/nginx_$NGINX.tpl"
|
||||
tpl_file="$WEBTPL/nginx/$NGINX.tpl"
|
||||
conf="$HOMEDIR/$user/conf/web/tmp_nginx.conf"
|
||||
add_web_config
|
||||
chown root:nginx $conf
|
||||
chmod 640 $conf
|
||||
|
||||
if [ "$SSL" = 'yes' ]; then
|
||||
tpl_file="$WEBTPL/nginx_$NGINX.stpl"
|
||||
tpl_file="$WEBTPL/nginx/$NGINX.stpl"
|
||||
conf="$HOMEDIR/$user/conf/web/tmp_snginx.conf"
|
||||
add_web_config
|
||||
chown root:nginx $conf
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue