alias macro fixes
This commit is contained in:
parent
8c68b39834
commit
4bba0e9cc4
|
@ -18,6 +18,8 @@ help()
|
|||
echo " -d <domain> Domain name of VirtualHost to remove."
|
||||
echo " -m <macro> Name of Apache macro to apply."
|
||||
echo " -o <option> Subdomain or Alias or Redirect URL if specified macro requires one."
|
||||
echo " For Alias domains '-d <domain>' is the alias domain, and '-o <alias>'"
|
||||
echo " is the existing VirtualHost to alias to."
|
||||
echo ""
|
||||
echo " Available Apache Macros:"
|
||||
echo ""
|
||||
|
@ -121,8 +123,8 @@ if [[ "$macro" == *"VHost"* ]]; then
|
|||
if [ -n $option ]; then
|
||||
alias=$option
|
||||
# make sure Alias domain isn't already installed as it's own vhost
|
||||
if [ -d "/srv/www/$alias" ]; then
|
||||
echo "$alias is already installed as it's own vhost"
|
||||
if [ -d "/srv/www/$domain" ]; then
|
||||
echo "$domain is already installed as it's own vhost"
|
||||
exit 1
|
||||
else
|
||||
macro_vhost_line="$macro_vhost_line $alias"
|
||||
|
@ -164,13 +166,9 @@ fi
|
|||
|
||||
# if https check for le cert
|
||||
if [[ "$macro" == *"HTTPS"* ]]; then
|
||||
if [[ "$macro" == *"Alias"* ]]; then
|
||||
cert_host="$alias"
|
||||
else
|
||||
cert_host=$domain
|
||||
if [[ "$macro" == *"Subdomain"* ]]; then
|
||||
cert_host="$subdomain.$cert_host"
|
||||
fi
|
||||
cert_host=$domain
|
||||
if [[ "$macro" == *"Subdomain"* ]]; then
|
||||
cert_host="$subdomain.$cert_host"
|
||||
fi
|
||||
if [[ ! -f "/etc/ssl/letsencrypt/$cert_host.pem" ]]; then
|
||||
echo "cert file for $cert_host does not exist"
|
||||
|
|
|
@ -201,10 +201,10 @@
|
|||
|
||||
<Macro VHostAliasHTTP $vhost $username $alias>
|
||||
<VirtualHost *:80>
|
||||
ServerName $alias
|
||||
ServerAlias www.$alias
|
||||
ServerAlias $alias.example.com
|
||||
DocumentRoot /srv/www/$vhost/html
|
||||
ServerName $vhost
|
||||
ServerAlias www.$vhost
|
||||
ServerAlias $vhost.example.com
|
||||
DocumentRoot /srv/www/$alias/html
|
||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
|
@ -213,10 +213,10 @@
|
|||
|
||||
<Macro VHostAliasHTTPS $vhost $username $alias>
|
||||
<VirtualHost *:80>
|
||||
ServerName $alias
|
||||
ServerAlias www.$alias
|
||||
ServerAlias $alias.example.com
|
||||
DocumentRoot /srv/www/$vhost/html
|
||||
ServerName $vhost
|
||||
ServerAlias www.$vhost
|
||||
ServerAlias $vhost.example.com
|
||||
DocumentRoot /srv/www/$alias/html
|
||||
## <Location "/">
|
||||
## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
|
||||
## Redirect 301 "https://%{HTTP_HOST}%{REQUEST_URI}"
|
||||
|
@ -227,10 +227,10 @@
|
|||
</FilesMatch>
|
||||
</VirtualHost>
|
||||
<VirtualHost *:443>
|
||||
ServerName $alias
|
||||
ServerAlias www.$alias
|
||||
ServerAlias $alias.example.com
|
||||
DocumentRoot /srv/www/$vhost/html
|
||||
ServerName $vhost
|
||||
ServerAlias www.$vhost
|
||||
ServerAlias $vhost.example.com
|
||||
DocumentRoot /srv/www/$alias/html
|
||||
<FilesMatch ".+\.ph(ar|p|tml)$">
|
||||
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
|
|
Loading…
Reference in New Issue
Block a user