|
@ -543,6 +543,14 @@ EOF |
|
|
__vhost_head_statement() { |
|
|
__vhost_head_statement() { |
|
|
local cfg="$1" protocol="$2" domain="$3" server_aliases admin_mail prefix |
|
|
local cfg="$1" protocol="$2" domain="$3" server_aliases admin_mail prefix |
|
|
admin_mail=$(e "$1" | cfg-get-value "admin-mail" 2>/dev/null) || true |
|
|
admin_mail=$(e "$1" | cfg-get-value "admin-mail" 2>/dev/null) || true |
|
|
|
|
|
if [ -z "$admin_mail" ]; then |
|
|
|
|
|
if [ -z "$domain" ]; then |
|
|
|
|
|
admin_mail=webmaster@localhost |
|
|
|
|
|
else |
|
|
|
|
|
admin_mail=${admin_mail:-contact@$domain} |
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
server_aliases=$(e "$cfg" | cfg-get-value server-aliases 2>/dev/null) || true |
|
|
server_aliases=$(e "$cfg" | cfg-get-value server-aliases 2>/dev/null) || true |
|
|
[ "$server_aliases" == None ] && server_aliases="" |
|
|
[ "$server_aliases" == None ] && server_aliases="" |
|
|
if [ "$server_aliases" ]; then |
|
|
if [ "$server_aliases" ]; then |
|
@ -561,18 +569,25 @@ __vhost_head_statement() { |
|
|
prefix= |
|
|
prefix= |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
if [ "$domain" ]; then |
|
|
|
|
|
log_prefix="${prefix}${domain}_" |
|
|
|
|
|
else |
|
|
|
|
|
log_prefix="" |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
cat <<EOF |
|
|
cat <<EOF |
|
|
ServerAdmin ${admin_mail:-contact@$domain} |
|
|
|
|
|
ServerName ${domain} |
|
|
|
|
|
$( |
|
|
$( |
|
|
|
|
|
echo "ServerAdmin ${admin_mail}" |
|
|
|
|
|
[ "$domain" ] && echo "ServerName ${domain}" |
|
|
for alias in "${server_aliases[@]}"; do |
|
|
for alias in "${server_aliases[@]}"; do |
|
|
[ "$alias" ] || continue |
|
|
[ "$alias" ] || continue |
|
|
echo "ServerAlias $alias" |
|
|
echo "ServerAlias $alias" |
|
|
done |
|
|
done |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
ServerSignature Off |
|
|
ServerSignature Off |
|
|
CustomLog /var/log/apache2/${prefix}${domain}_access.log combined |
|
|
|
|
|
ErrorLog /var/log/apache2/${prefix}${domain}_error.log |
|
|
|
|
|
|
|
|
CustomLog /var/log/apache2/${log_prefix}access.log combined |
|
|
|
|
|
ErrorLog /var/log/apache2/${log_prefix}error.log |
|
|
ErrorLog syslog:local2 |
|
|
ErrorLog syslog:local2 |
|
|
EOF |
|
|
EOF |
|
|
|
|
|
|
|
@ -724,9 +739,12 @@ __vhost_full_vhost_statement() { |
|
|
cat <<EOF |
|
|
cat <<EOF |
|
|
<VirtualHost *:$PORT> |
|
|
<VirtualHost *:$PORT> |
|
|
|
|
|
|
|
|
$(echo "$head_statement" | prefix " ") |
|
|
|
|
|
$(echo "$custom_rules" | prefix " ") |
|
|
|
|
|
$(echo "$content_statement" | prefix " ") |
|
|
|
|
|
|
|
|
$( |
|
|
|
|
|
{ |
|
|
|
|
|
echo "$head_statement" |
|
|
|
|
|
[ "$custom_rules" ] && echo "$custom_rules" |
|
|
|
|
|
echo "$content_statement" |
|
|
|
|
|
} | prefix " ") |
|
|
|
|
|
|
|
|
## Forbid any cache, this is only usefull on dev server. |
|
|
## Forbid any cache, this is only usefull on dev server. |
|
|
#Header set Cache-Control "no-cache" |
|
|
#Header set Cache-Control "no-cache" |
|
@ -744,6 +762,8 @@ __vhost_publish_dir_statement() { |
|
|
local_path="/var/www/${dest}" |
|
|
local_path="/var/www/${dest}" |
|
|
|
|
|
|
|
|
cat <<EOF |
|
|
cat <<EOF |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
## |
|
|
## Publish directory $local_path |
|
|
## Publish directory $local_path |
|
|
## |
|
|
## |
|
|