diff --git a/etc/apache2/mods-available/macro.conf b/etc/apache2/mods-available/macro.conf index d30c9da..7911495 100644 --- a/etc/apache2/mods-available/macro.conf +++ b/etc/apache2/mods-available/macro.conf @@ -17,12 +17,19 @@ # VHostAliasHTTPSVarnish for http & https # *only use one of the Alias options above at at time* -# VHostHTTP - HTTP on Port 80. Includes ServerAlias for .example.com subdomain + +# Optional AliasDomain for accessing VirtualHosts. +# Uncomment and change example.com to suit your needs. +#Define AliasDomain example.com + +# VHostHTTP - HTTP on Port 80 ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/" RewriteEngine on @@ -37,7 +44,9 @@ ServerName $subdomain.$vhost - ServerAlias $subdomain.$vhost.example.com + + ServerAlias $subdomain.$vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/$subdomain SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" @@ -45,12 +54,14 @@ -# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .example.com subdomain +# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for ${AliasDomain} subdomain ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/" RewriteEngine on @@ -68,7 +79,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/" RewriteEngine on @@ -95,11 +108,13 @@ -# VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .example.com subdomain +# VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for ${AliasDomain} subdomain ServerName $subdomain.$vhost - ServerAlias $subdomain.$vhost.example.com + + ServerAlias $subdomain.$vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/$subdomain ## ## @@ -112,7 +127,9 @@ ServerName $subdomain.$vhost - ServerAlias $subdomain.$vhost.example.com + + ServerAlias $subdomain.$vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/$subdomain SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" @@ -127,7 +144,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$vhost/" RewriteEngine on @@ -140,7 +159,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + RequestHeader set X-Forwarded-Proto https ProxyPreserveHost On ProxyPass / http://127.0.0.1:6081/ @@ -154,7 +175,9 @@ ServerName $subdomain.$vhost - ServerAlias $subdomain.$vhost.example.com + + ServerAlias $subdomain.$vhost.${AliasDomain} + DocumentRoot /srv/www/$vhost/$subdomain SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" @@ -162,7 +185,9 @@ ServerName $subdomain.$vhost - ServerAlias $subdomain.$vhost.example.com + + ServerAlias $subdomain.$vhost.${AliasDomain} + RequestHeader set X-Forwarded-Proto https ProxyPreserveHost On ProxyPass / http://127.0.0.1:6081/ @@ -194,7 +219,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + Redirect 301 "$redirect%{REQUEST_URI}" @@ -207,7 +234,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + Redirect 301 "$redirect%{REQUEST_URI}" @@ -217,7 +246,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + Redirect 301 "$redirect%{REQUEST_URI}" @@ -232,7 +263,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$alias/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$alias/" RewriteEngine on @@ -248,7 +281,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$alias/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$alias/" RewriteEngine on @@ -266,7 +301,9 @@ ServerName $vhost ServerAlias www.$vhost - ServerAlias $vhost.example.com + + ServerAlias $vhost.${AliasDomain} + DocumentRoot /srv/www/$alias/html ScriptAlias /cgi-wrap/ "/usr/local/lib/cgi-wrap/$alias/" RewriteEngine on