www not working

I’m new to all this so sorry if this is a silly question.

If I visit my site without the www it works fine, but with the www I get an error “server IP address could not be found.”

I followed the tutorials and my file: /etc/nginx/sites-available/ looks like this:

server { listen 80; listen [::]:80;

    root /var/www/;
    index index.html index.htm index.nginx-debian.html;


    location / {
            try_files $uri $uri/ =404;


Am I missing something?



Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you!

Yup, I think you’re missing the DNS entry…

Please go back to you Domain Registrar or Domain Management and check if you have a CNAME www (value) that points to (don’t miss the . [dot] after uk, that’s important).

Just in case, if you want to redirect non www to www :

server { listen 80; server_name; return 301$request_uri; }

Hope that helped :) !

Hehe… I see that you have that entry:


If the problem still persists please clear your browser cache, it works for me both versions, www and no-www.

PS: Do a redirect from www to non-www or the other way around, stick with just one domain “version” for your website as Google will see this as duplicate content and you won’t get there any time soon.

And btw… allow a few minutes for DNS propagation, won’t work immediately.