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

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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 :) !