Score:0

www subdomain not working on AWS

in flag
Joe

I am hosting this site https://whitewaterwriters.com/ on an AWS instance.

I'd like the url https://www.whitewaterwriters.com/ to work as well, but it doesn't.

I understand that this happens in a 'hosted zone' in AWS. Here's my hosted zone:

enter image description here

...and I understand that I have put in the subdomain redirection properly.

I run a test and get:

enter image description here

which suggests that I'm on the right lines.

It's possible that the issue is that I don't have a TLS cert for https://www.whitewaterwriters.com/ yet, but I can't get one of those without the domain being visible, and my nginx doesn't allow it, so I've altered my nginx.conf to

   server {
        listen       80;
        listen       [::]:80;
        server_name  www.whitewaterwriters.com;
        location /{
                root /usr/share/nginx/html/whitewaterwriters-site/_site/;
        }

    }


    server {
        listen       80;
        listen       [::]:80;
        server_name  whitewaterwriters.com;
        return 301 https://$server_name$request_uri;
}

so that http://www.whitewaterwriters.com/ should at least work without the https, but no luck.

What am I doing wrong?

EDIT:

I've now added an a-record as well:

enter image description here

vn flag
You have a NS record for `www.whitewaterwriters.com`. You don't want that. You want an A record for it.
Joe avatar
in flag
Joe
To check - do I want both or just one? (and will add content)
vn flag
You want one set of `NS` records, for the non-www. Leave that alone (it's the one AWS added for you). Keep the A record for the non-www. Create a new A record for the www version, pointing to the same IP as the non-www. Remove the NS record for the www version.
Joe avatar
in flag
Joe
Thank you! That solved my problem (along with some faff in the nginx config) feel free to make it an answer.
Tim avatar
gp flag
Tim
You can also create a CNAME record for www. That results in an extra DNS lookup though. @ceejayoz maybe convert your comment to an answer so the question can be closed off?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.