|
|
@ -543,6 +543,14 @@ EOF |
|
|
|
__vhost_head_statement() { |
|
|
|
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 |
|
|
|
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" == None ] && server_aliases="" |
|
|
|
if [ "$server_aliases" ]; then |
|
|
@ -561,18 +569,25 @@ __vhost_head_statement() { |
|
|
|
prefix= |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "$domain" ]; then |
|
|
|
log_prefix="${prefix}${domain}_" |
|
|
|
else |
|
|
|
log_prefix="" |
|
|
|
fi |
|
|
|
|
|
|
|
cat <<EOF |
|
|
|
ServerAdmin ${admin_mail:-contact@$domain} |
|
|
|
ServerName ${domain} |
|
|
|
$( |
|
|
|
echo "ServerAdmin ${admin_mail}" |
|
|
|
[ "$domain" ] && echo "ServerName ${domain}" |
|
|
|
for alias in "${server_aliases[@]}"; do |
|
|
|
[ "$alias" ] || continue |
|
|
|
echo "ServerAlias $alias" |
|
|
|
done |
|
|
|
) |
|
|
|
|
|
|
|
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 |
|
|
|
EOF |
|
|
|
|
|
|
@ -724,9 +739,12 @@ __vhost_full_vhost_statement() { |
|
|
|
cat <<EOF |
|
|
|
<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. |
|
|
|
#Header set Cache-Control "no-cache" |
|
|
@ -744,6 +762,8 @@ __vhost_publish_dir_statement() { |
|
|
|
local_path="/var/www/${dest}" |
|
|
|
|
|
|
|
cat <<EOF |
|
|
|
|
|
|
|
|
|
|
|
## |
|
|
|
## Publish directory $local_path |
|
|
|
## |
|
|
|