Browse Source

new: dev: [apache] allow empty domain to make default site entry.

framadate
Valentin Lab 5 years ago
parent
commit
2f5aa5254c
  1. 34
      apache/lib/common
  2. 62
      apache/test/vhost
  3. 1
      apache/test/vhost_cert_provider

34
apache/lib/common

@ -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
##

62
apache/test/vhost

@ -51,6 +51,7 @@ is out '<VirtualHost *:80>
ErrorLog /var/log/apache2/www.example.com_error.log
ErrorLog syslog:local2
##
## Publish directory /var/www/www.example.com
##
@ -337,3 +338,64 @@ is out '<VirtualHost *:80>
</VirtualHost>
</IfModule>' RTRIM
##
## single def no domain
##
try "
apache_vhost_statement publish_dir ,http, '
apache-custom-rules: |
RewriteEngine On
RewriteCond %{QUERY_STRING} !skin=formanoo
RewriteRule ^(/web/webclient/home.*)$ $1?skin=formanoo [L,QSA,R=302]
target: popo:3333
' ""
" "http without domain"
noerror
is out '<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerSignature Off
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
ErrorLog syslog:local2
##
## Custom rules
##
RewriteEngine On
RewriteCond %{QUERY_STRING} !skin=formanoo
RewriteRule ^(/web/webclient/home.*)$ ?skin=formanoo [L,QSA,R=302]
##
## Publish directory /var/www/html
##
DocumentRoot /var/www/html
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Allow from all
</Directory>
## Forbid any cache, this is only usefull on dev server.
#Header set Cache-Control "no-cache"
#Header set Access-Control-Allow-Origin "*"
#Header set Access-Control-Allow-Methods "POST, GET, OPTIONS"
#Header set Access-Control-Allow-Headers "origin, content-type, accept"
</VirtualHost>' RTRIM

1
apache/test/vhost_cert_provider

@ -323,6 +323,7 @@ is out part 'file_put $SERVICE_CONFIGSTORE/etc/apache2/sites-enabled/www.example
| ServerName www.example.com
| ServerAlias example.fr
| ServerAlias example.de
|
| ServerSignature Off' RTRIM
is out part '
| ## Auto-redirection from http to https

Loading…
Cancel
Save