51 lines
1.5 KiB
Plaintext
51 lines
1.5 KiB
Plaintext
# 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>
|