I’ve got a successfully deployed site that works at the https://root domain using Lets Encrypt, but if I type in https://www.root it gives a “Connection is not private” warning and does not redirect.
I’ve tried setting www_redirect in the wordpress_sites file but can’t load the site with it set to true or false.
I just tried adding the wp_home and wp_siteurl fields as that page recommends but it made no difference after another provision and deploy. Config below for production, using Ansible 2.0.2.0
wordpress_sites:
pipercollective.com.au:
site_hosts:
- pipercollective.com.au
local_path: ../site # path targeting local Bedrock site directory (relative to Ansible root)
repo: git@github.com:SimeonGriggs/pipercollective.com.au.git # replace with your Git repo URL
repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo
branch: master
multisite:
enabled: false
ssl:
enabled: true
provider: letsencrypt
www_redirect: true
env:
wp_home: https://pipercollective.com.au
wp_siteurl: https://pipercollective.com.au/wp
cache:
enabled: false
Bah. I hope not. It’s already a bit of a pain to have to edit config files just to get the .com.au to work. The site is straight-up broken if the www loads with security errors and won’t redirect
I searched again and found the discourse thread I vaguely remembered addressing the issue. Turns out you were on that thread, so you’ve already implemented a temporary solution before. An alternative temporary solution might be to set up a specific redirect using an nginx include.
As for the nginx include, I’m not really following that documentation. And the www redirect works on my development server (though it’s non-https). It just won’t redirect the https://www in production.
I’m not certain this will work, but you could try the temporary solution (I think you’ve applied that already) then run these steps to hopefully iron out potential problems in your nginx conf.
If that doesn’t resolve the issue, could you update us on what the latest errors are exactly?
I apologize for mentioning the nginx includes option because looking at it a little more, I see that it will not currently accommodate your redirect on the domain level. The problem is that the includes happen within the server block but in your case would need to create a separate server block. If you’re curious, however, here is an example of using nginx includes.
Not sure if this is problem, but reminds me of an issue I had with SSL redirects because the certs and ssl config file were not put in the redirect block in the conf file. This PR fixed it https://github.com/roots/trellis/pull/537. But check your conf file and make sure the redirect block has the needed ssl certs.
Sorry yea not super clear in PR. My point was making sure that in your sites-enabled/website.org file making sure that the block that the redirects SSL www to non-www has ssl info in it so like:
server {
listen 443 ssl spdy;
server_name www.example.org;
return 301 $scheme://example.org$request_uri;
include ssl.conf;
include ssl-stapling.conf;
ssl_certificate /etc/nginx/ssl/example.pem;
ssl_trusted_certificate /etc/nginx/ssl/example.pem;
ssl_certificate_key /etc/nginx/ssl/example.key;
}
This is an older version of Trellis so yours might look different but it needs to have those certificates or else it will give the Connection is not private warning and not redirect.
I’ve never used letsencrypt, but I guess it’d have to be wildcard for it to redirect from that www? IDK
I added it into wordpress-site.conf.js, deployed, and got a ‘too many redirects’ error.
My development version doesn’t have https enabled and it redirects www to root fine. But the production server just won’t do it. Will keep experimenting with this conf file I guess.
…and for the record, it’s an international domain so likely that the issue reported in response to roots/trellis#570 is indeed the culprit as pointed out by @fullyint.
I’m still having this issue. I was hoping removing all Let’s Encrypt data like in this thread and re-provisioning would fix it, but it didn’t.
I created a new instance if the Staging server, provisioned, deployed and even migrated the DB from Production to Staging, and it does not have the same problem. Though, the Staging server has a .xyz domain, and the Production has .com.au – so it could still be related to international domains.
(But then that said, I’ve deployed another .com.au website using Trellis/Let’s Encrypt and it does not have this issue … confusing!)
One thing I’m not sure about: if I snapshot the existing droplet and then refresh it back to a clean install of Ubuntu 12.04 and then re-provision with a fresh let’s encrypt certificate, could I go back and use the old snapshot and the old certificate again if necessary?
This time ansible completed without an error, but the www subdomain is still insecure and not redirecting.
Looking at the nginx config in sites-available, I can see the following server block:
server {
listen 443 ssl http2;
include h5bp/directive-only/ssl.conf;
include h5bp/directive-only/ssl-stapling.conf;
ssl_dhparam /etc/nginx/ssl/dhparams.pem;
ssl_buffer_size 1400; # 1400 bytes to fit in one MTU
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
ssl_certificate /etc/nginx/ssl/letsencrypt/volunteeringmatters.org.uk-bundled.cert;
ssl_certificate_key /etc/nginx/ssl/letsencrypt/volunteeringmatters.org.uk.key;
server_name www.volunteeringmatters.org.uk;
return 301 $scheme://volunteeringmatters.org.uk$request_uri;
}
I’m working on a PR to recreate the CSRs and certs if site_hosts or www_redirect are modified. I’ll hopefully at least post it for review in the next day or two.
As for the steps to make the www_redirect work for international domains, it will require some extensive careful work, which accounts for the delay.