Roots Discourse

Https site cannot add www redirect after provisioning the first time

Trellis doesn’t seem to be requesting/creating/installing (?) a Let’s Encrypt certificate for the www record for my site upon provisioning.

According to Firefox, which is the most verbose about the problem, the certificate installed is only valid for, and not for

There is a valid A record for www, pointed to the site’s IP.

What can I look at to troubleshoot this issue, or to force Trellis to generate a certificate that includes www?


Paste the contents of your wordpress_sites.yml. was re-provisioned on a new droplet last night with the latest Trellis and is functioning as expected

I’ve replaced the actual URL with “” in the following. If it’s absolutely necessary to share the URL let me know. Thanks for your quick reply.

The commented out redirects were an attempt to force the matter with Let’s Encrypt and did not work.

# Documentation:
# `wordpress_sites` options:
# Define accompanying passwords/secrets in group_vars/staging/vault.yml

      - canonical:
        # redirects:
        # -
    local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
    repo: # replace with your Git repo URL
    repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
    branch: master
      enabled: false
      enabled: true
      provider: letsencrypt
      enabled: false


You commented out this line for the redirects:

# -

Since that’s missing, LE is not going to handle www.

With that redirect uncommented I get the following error upon provisioning:

Could not access the challenge file for the hosts/domains:
Let's Encrypt requires every domain/host be publicly accessible. Make sure
that a valid DNS record exists for and that they point to this
server's IP. If you don't want these domains in your SSL certificate, then
remove them from `site_hosts`. See for more

There is a valid A record for the www record, pointing to the site’s IP (the same IP that the catchall record points to, which works).

Is there another location in Trellis config that I need to enter the “www” version of the URL?

Without you providing us with the actual domain it’s hard to give you more specifics.

If LE is saying the DNS isn’t accessible I wouldn’t think that they’re lying. Either check your records or wait?

Thanks again for your quick replies. Reading it also seems like Trellis should be requesting certs for the www and non-www versions of each domain. Is that not accurate?

Looks like those docs are outdated after

Is your Trellis installation up to date with 0.9.8?

Yes Trellis is up to date with 0.9.8. That definitely helps clarify things.

Is there somewhere else in Trellis config that I need to specify the www URL so that the server “listens” on that URL? The www record is correct at Network Solutions, but LE fails with the above message.

No. You can compare with the repository at which is functioning as you are wanting your site to.

Trellis uses the values under canonical

If your server isn’t provisioning correctly then try re-provisioning it (or destroying it).

Okay. Figured it out.

I rebuilt my droplet and reprovisioned from scratch with the redirect entered correctly in wordpress_sites.yml, now that I understand this is necessary… and it worked. The cert was generated properly with both the www and non-www addresses.

So apparently you can’t add a www redirect AFTER provisioning the server.

Could this have to do with HSTS preventing non-encrypted traffic?

Either way, I now understand how to set up my wordpress_sites.yml files going forward. I appreciate all your attention on this topic; you definitely helped me understand what was going on so that I could find the solution.

Have a great day!

1 Like

You should be able to add a www redirect URL but you most likely need to re-run provision tag wordpress-setup (and letsencrypt).

I tried this a few times and was unable. Perhaps I was doing something wrong, though.

@MWDelaney Indeed, Trellis Let’s Encrypt does not yet handle changes to site_hosts. This will be addressed in roots/trellis#630 or some variant. In the meantime, you can reprovision from scratch, as you did, or similar to what @cfx described, follow steps here.


I tried this once and it worked. I ran the provision tag wordpress then removed my certificates and ran the provision tag letsencrypt. “Was unable” won’t get you much help :wink: