In article <[email protected]> you wrote: > Hi! > > I thought I could copy the same static server definition block and only > change a unique macro definition at the top of each server. But this is > not working: > > ############################## > # from httpd.conf > ############################## > # [...] > > # macro definition > certroot="/etc/ssl/httpd" > docroot="/htdocs" > > domain="domain.tld" > server $domain{ > listen on * tls port 443 > tls certificate $certroot/$domain/$domain.pem > tls key $certroot/$domain/$domain.key > root $docroot/$domain > } > > domain="anotherdomain.tld" > server $domain{ > listen on * tls port 443 > tls certificate $certroot/$domain/$domain.pem > tls key $certroot/$domain/$domain.key > root $docroot/$domain > } > > # [...] > ############################## > > The idea was if you have a lot of server definitions you could keep > static the parts that are the same and just change the macro for each > server the line above the server block. > > Because httpd.conf man page says "Macros are not expanded inside > quotes." I cannot use 'root "$docroot/$domain"'. But 'root > $docroot/$domain' isn't accepted either. Does that mean I cannot use > Macros for parts of the config file that reference to files or folders, > because Macros are not expanded inside quotes but keywords with file or > folder options require enclosing quotes? If that's the case I don't > understand what Macros are good for. > > Thanks in advance! > > T. > >
There is another problem I mentioned here time ago. Macros have problems with slashes. The same happens in pf.conf (and perhaps with smtpd.conf too). Unless it was already fixed, when you want to add a path to a macro you must enclose it within double and single quotes: certroot='"/etc/ssl/httpd"' Then $certroot is expanded to "/etc/ssl/httpd" including the doble quotes.

