Last active
October 1, 2023 20:08
-
-
Save aikar/b14091c8a600f6bab9fd to your computer and use it in GitHub Desktop.
Example of Apache mod_macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Macro Site $domain> | |
Use Log $domain | |
Use ForceDomain $domain | |
Use GrantAccess / | |
</Macro> | |
<Macro Domain $domain> | |
ServerName $domain | |
ServerAlias www.$domain | |
</Macro> | |
<Macro GrantAccess $path> | |
<Location $path> | |
Order allow,deny | |
Allow from all | |
</Location> | |
</Macro> | |
<Macro Log $site> | |
ErrorLog /var/log/apache2/sites/$site_error_log | |
CustomLog /var/log/apache2/sites/$site_access_log combined | |
</Macro> | |
<Macro ForceDomain $domain> | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^$domain [NC] | |
RewriteCond %{HTTPS} =on | |
RewriteRule (.*) http://$domain/$1 [R,L,QSA] | |
RewriteCond %{HTTP_HOST} ^$domain [NC] | |
RewriteCond %{HTTPS} !=on | |
RewriteRule (.*) https://$domain/$1 [R,L,QSA] | |
</Macro> | |
<Macro ProxyPass $path $dest> | |
ProxyPass $path $dest | |
ProxyPassReverse $path $dest | |
</Macro> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment