November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

SHORTENING APACHE CONFIGS USING MOD_MACRO

It is possible to use macros in the Apache config files to shorten them and make them easier to read and manage. To use this you have to install mod_macro if it’s not already installed in your distribution.

Sample mod_macro usage



ServerName $domain
ServerAlias www.$domain
DocumentRoot /vaw/www/$customer/htdocs/$domain/
ScriptAlias /cgi-bin/ /var/www/$customer/cgi-bin/
ErrorLog /var/log/apache/$customer/logs/$domain-error.log
CustomLog /var/log/apache/$customer/logs/$domain-access.log combined

Options ExecCGI,noIndexes


Use VHost customer_A example.com
Use VHost customer_B example.net
Use VHost customer_C example.org
Another example


AuthName “Restricted area”
AuthType Basic
AuthUserFile /var/www/.htpasswd
require valid-user


Options Indexes


Use PasswordProtect
Options -Indexes


Use PasswordProtect
Options +FollowSymLinks

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>