www not working

Posted January 21, 2019 5.4k views

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?


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.

Submit an Answer
5 answers

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).

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

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.

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

server {
listen 80;
return 301$request

Hope that helped :) !