macro fixes

This commit is contained in:
Matthew Saunders Brown 2021-04-13 15:06:53 -07:00
parent 3cad8c12c6
commit dc11608f1b
2 changed files with 19 additions and 69 deletions

View File

@ -1,50 +0,0 @@
# VHostHTTP for http only
# VHostHTTPS for http & https w/ optional http to https redirect
# only use one of the above at at time
# VHostMAIL for webmail at mail. subdomain assumes/requires https w/ valid cert
# VHostHTTP - HTTP on Port 80. Includes ServerAlias for .mylampsite.com subdomain
<Macro VHostHTTP $vhost>
<VirtualHost *:80>
ServerName $vhost
ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com
DocumentRoot /srv/www/$vhost/html
</VirtualHost>
</Macro>
# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .mylampsite.com subdomain
<Macro VHostHTTPS $vhost>
<VirtualHost *:80>
ServerName $vhost
ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com
<Location "/">
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect 301 "https://%{HTTP_HOST}%{REQUEST_URI}"
</If>
</Location>
</VirtualHost>
<VirtualHost *:443>
ServerName $vhost
ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com
DocumentRoot /srv/www/$vhost/html
SSLCertificateFile /etc/ssl/letsencrypt/$vhost.pem
</VirtualHost>
</Macro>
# Webmail - HTTP Port 80 Redirects to HTTPS Port 443
<Macro VHostMAIL $vhost>
<VirtualHost *:80>
ServerName mail.$vhost
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect / https://mail.$vhost
</If>
</VirtualHost>
<VirtualHost *:443>
ServerName mail.$vhost
DocumentRoot /srv/www/html/webmail/
SSLCertificateFile /etc/ssl/letsencrypt/mail.$vhost.pem
</VirtualHost>
</Macro>

View File

@ -17,12 +17,12 @@
# VHostAliasHTTPSVarnish for http & https # VHostAliasHTTPSVarnish for http & https
# *only use one of the Alias options above at at time* # *only use one of the Alias options above at at time*
# VHostHTTP - HTTP on Port 80. Includes ServerAlias for .mylampsite.com subdomain # VHostHTTP - HTTP on Port 80. Includes ServerAlias for .example.com subdomain
<Macro VHostHTTP $vhost $username> <Macro VHostHTTP $vhost $username>
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$vhost/html DocumentRoot /srv/www/$vhost/html
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -33,7 +33,7 @@
<Macro VHostSubdomainHTTP $vhost $username $subdomain> <Macro VHostSubdomainHTTP $vhost $username $subdomain>
<VirtualHost *:80> <VirtualHost *:80>
ServerName $subdomain.$vhost ServerName $subdomain.$vhost
ServerAlias $subdomain.$vhost.mylampsite.com ServerAlias $subdomain.$vhost.example.com
DocumentRoot /srv/www/$vhost/$subdomain DocumentRoot /srv/www/$vhost/$subdomain
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -41,12 +41,12 @@
</VirtualHost> </VirtualHost>
</Macro> </Macro>
# VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .mylampsite.com subdomain # VHostHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .example.com subdomain
<Macro VHostHTTPS $vhost $username> <Macro VHostHTTPS $vhost $username>
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$vhost/html DocumentRoot /srv/www/$vhost/html
## <Location "/"> ## <Location "/">
## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> ## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
@ -60,7 +60,7 @@
<VirtualHost *:443> <VirtualHost *:443>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$vhost/html DocumentRoot /srv/www/$vhost/html
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -70,11 +70,11 @@
</VirtualHost> </VirtualHost>
</Macro> </Macro>
# VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .mylampsite.com subdomain # VHostSubdomainHTTPS - HTTPS on Port 443. Inludes Port 80 and ServerAliases for .example.com subdomain
<Macro VHostSubdomainHTTPS $vhost $username $subdomain> <Macro VHostSubdomainHTTPS $vhost $username $subdomain>
<VirtualHost *:80> <VirtualHost *:80>
ServerName $subdomain.$vhost ServerName $subdomain.$vhost
ServerAlias $subdomain.$vhost.mylampsite.com ServerAlias $subdomain.$vhost.example.com
DocumentRoot /srv/www/$vhost/$subdomain DocumentRoot /srv/www/$vhost/$subdomain
## <Location "/"> ## <Location "/">
## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> ## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
@ -87,7 +87,7 @@
</VirtualHost> </VirtualHost>
<VirtualHost *:443> <VirtualHost *:443>
ServerName $subdomain.$vhost ServerName $subdomain.$vhost
ServerAlias $subdomain.$vhost.mylampsite.com ServerAlias $subdomain.$vhost.example.com
DocumentRoot /srv/www/$vhost/$subdomain DocumentRoot /srv/www/$vhost/$subdomain
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -102,7 +102,7 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$vhost/html DocumentRoot /srv/www/$vhost/html
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -111,7 +111,7 @@
<VirtualHost *:443> <VirtualHost *:443>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
RequestHeader set X-Forwarded-Proto https RequestHeader set X-Forwarded-Proto https
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass / http://127.0.0.1:6081/ ProxyPass / http://127.0.0.1:6081/
@ -125,7 +125,7 @@
<Macro VHostSubdomainHTTPSVarnish $vhost $username $subdomain> <Macro VHostSubdomainHTTPSVarnish $vhost $username $subdomain>
<VirtualHost *:80> <VirtualHost *:80>
ServerName $subdomain.$vhost ServerName $subdomain.$vhost
ServerAlias $subdomain.$vhost.mylampsite.com ServerAlias $subdomain.$vhost.example.com
DocumentRoot /srv/www/$vhost/$subdomain DocumentRoot /srv/www/$vhost/$subdomain
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -133,7 +133,7 @@
</VirtualHost> </VirtualHost>
<VirtualHost *:443> <VirtualHost *:443>
ServerName $subdomain.$vhost ServerName $subdomain.$vhost
ServerAlias $subdomain.$vhost.mylampsite.com ServerAlias $subdomain.$vhost.example.com
RequestHeader set X-Forwarded-Proto https RequestHeader set X-Forwarded-Proto https
ProxyPreserveHost On ProxyPreserveHost On
ProxyPass / http://127.0.0.1:6081/ ProxyPass / http://127.0.0.1:6081/
@ -165,7 +165,7 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
<Location "/"> <Location "/">
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect 301 "$redirect%{REQUEST_URI}" Redirect 301 "$redirect%{REQUEST_URI}"
@ -178,7 +178,7 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
<Location "/"> <Location "/">
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect 301 "$redirect%{REQUEST_URI}" Redirect 301 "$redirect%{REQUEST_URI}"
@ -188,7 +188,7 @@
<VirtualHost *:443> <VirtualHost *:443>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
<Location "/"> <Location "/">
<If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
Redirect 301 "$redirect%{REQUEST_URI}" Redirect 301 "$redirect%{REQUEST_URI}"
@ -203,7 +203,7 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$alias/html DocumentRoot /srv/www/$alias/html
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"
@ -215,7 +215,7 @@
<VirtualHost *:80> <VirtualHost *:80>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$alias/html DocumentRoot /srv/www/$alias/html
## <Location "/"> ## <Location "/">
## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#"> ## <If "%{REQUEST_URI} !~ m#^/.well-known/acme-challenge/#">
@ -229,7 +229,7 @@
<VirtualHost *:443> <VirtualHost *:443>
ServerName $vhost ServerName $vhost
ServerAlias www.$vhost ServerAlias www.$vhost
ServerAlias $vhost.mylampsite.com ServerAlias $vhost.example.com
DocumentRoot /srv/www/$alias/html DocumentRoot /srv/www/$alias/html
<FilesMatch ".+\.ph(ar|p|tml)$"> <FilesMatch ".+\.ph(ar|p|tml)$">
SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost" SetHandler "proxy:unix:/run/php/php7.4-fpm-$username.sock|fcgi://localhost"