httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emanuele Bastianelli <>
Subject [users@httpd] Apache 2.4 mod_macro does not instantiate all the defined Macros
Date Mon, 12 Sep 2016 10:42:06 GMT
I'm using Apache 2.4 with mod_macro. According to the documentation
<>, it is possible to
instantiate several macro, in order to not to rewrite the same block of
configuration. Example from the documentation:

<Macro VHost $name $domain>
  <VirtualHost *:80>
    ServerName $domain
    ServerAlias www.$domain

    DocumentRoot "/var/www/vhosts/$name"
    ErrorLog "/var/log/httpd/$name.error_log"
    CustomLog "/var/log/httpd/$name.access_log" combined

Use VHost example
Use VHost myhost
Use VHost apache

I did the same for my server, with the following VirtualHost configuration

<Macro VHost $request_uri>
    <VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        DBDriver mysql
        DBDParams "host=localhost port=3306 user=myself
pass=myselfpass dbname=apacheauth"
        DBDMin  2
        DBDKeep 4
        DBDMax  10
        DBDExptime 300

        <Location $request_uri>
          AuthName $request_uri
          AuthType Digest
          AuthDigestAlgorithm MD5
          AuthDigestDomain /
          AuthDigestProvider dbd
          AuthDBDUserRealmQuery "SELECT MD5(password) FROM password
WHERE username = %s AND realm = %s"
          Require valid-user


Use VHost /test
Use VHost /anothertest

The prolem is that the configuration work when I try to access, asking me for the credential, and does not work when I
try to access, showing me the current page
without asking the credential. It seems like the server instantiates a
VirtualHostonly for the first Use directive, skipping all the following.



View raw message