Error with apache macros

Recently I updated my apache configuration with a new version using Apache macros. Since I updated the configuration Letsencrypt fails to renew the certificate.

My apache version is:

2.4.7-1ubuntu4.18

The command used to renew is:

certbot-auto --dry-run --apache certonly --non-interactive -d my-domain-name-here.com -d www.my-domain-name-here.com

then I get this warning below and finally the challenge fails.

Encountered vhost ambiguity when trying to find a vhost for my-domain-name-here.com but was unable
to ask for user guidance in non-interactive mode. Certbot may need vhosts to be explicitly
labelled with ServerName or ServerAlias directives.                                   
Falling back to default vhost *:443...

My conf file looks like this:

<Macro Domains1>
    ServerName my-domain-name-here.com
    ServerAlias www.my-domain-name-here.com
</Macro>

<Macro WebDir1>
    AllowOverride All
    Options +Includes
</Macro>

Use SimpleHost 1.2.3.4 my-domain-name-here.com mydomainname Domains1 WebDir1

SimpleHost is a macro which uses the other macros with details about aliases and options. Once the macros have been expanded the result would be like a regular VirtualHost. My Apache configuration is valid but Letsencrypt cannot understand it :confused: .

Is there some way to tell LetsEncrypt about the domain IP and other information it could need? for example as comments in the apache conf or something similar? Thanks

Just use the option --webroot and the parameter -w (–webroot-path) to tell certbot where to place the challenge files:

Thanks @bytecamp. It worked :sweat_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.