update add-alias to link it to specified domain
This commit is contained in:
parent
cd6abd008d
commit
d739a4838e
|
@ -114,9 +114,10 @@ check-vhosts -f
|
||||||
|
|
||||||
List suggested changes to vhosts, apply fixes with -f
|
List suggested changes to vhosts, apply fixes with -f
|
||||||
|
|
||||||
add-alias VHOST ALIAS
|
add-alias VHOST ALIAS DOMAIN
|
||||||
|
|
||||||
Add a ServerAlias to an Apache vhost
|
Add a ServerAlias to an Apache vhost
|
||||||
|
If DOMAIN is not specified, apply to the whole file
|
||||||
|
|
||||||
del-alias VHOST ALIAS
|
del-alias VHOST ALIAS
|
||||||
|
|
||||||
|
@ -820,11 +821,12 @@ op_listvhost() {
|
||||||
}
|
}
|
||||||
|
|
||||||
op_aliasadd() {
|
op_aliasadd() {
|
||||||
if [ $# -eq 2 ]; then
|
if [ $# -ge 2 ] && [ $# -le 3 ]; then
|
||||||
vhost="${1}.conf"
|
vhost="${1}.conf"
|
||||||
alias=$2
|
alias=$2
|
||||||
|
domain=${3:-''}
|
||||||
|
|
||||||
[ -f $VHOST_PATH/"$vhost" ] && sed -i "/ServerName .*/a \\\tServerAlias $alias" "$VHOST_PATH"/"$vhost" --follow-symlinks
|
[ -f $VHOST_PATH/"$vhost" ] && sed -i "/ServerName $domain/a \\\tServerAlias $alias" "$VHOST_PATH"/"$vhost" --follow-symlinks
|
||||||
|
|
||||||
apache2ctl configtest 2>/dev/null
|
apache2ctl configtest 2>/dev/null
|
||||||
/etc/init.d/apache2 force-reload >/dev/null
|
/etc/init.d/apache2 force-reload >/dev/null
|
||||||
|
|
Loading…
Reference in a new issue