www not working

Before you spend hours of working on Nginx config etc., check your domain’s DNS records.

You need to have a record resembling this:

Type: CNAME

Hostname/Name: http://www.your.website

Value: your.website

TTL (seconds): 3600

And in Nginx you need to capture http://www.your.website (port 80) and redirect it to https://your.website (port 443). Something like this:

server {
    listen 80;
    
    server_name www.your.website
    return 301 https://your.website$request_uri;
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.