Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
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.
Hi @benwed,
Can you post your whole server block? At the moment what I see look okay but still want to be sure.
If have mentioned you can’t see any errors, this leads me to believe that your www record is not actually working properly.
If you ping your www domain
ping www.domain.com
Where domain.com is your really domain, what does it return, do you see your droplet’s IP address or something else?
Regards, KFSys
An update answer on an older topic
Based on the description, it seems like the issue might be related to DNS configuration or SSL certificate configuration rather than your Nginx setup. Your Nginx configuration appears to be correct for handling both site.com and www.site.com. Here are a few steps you can follow to troubleshoot the issue:
Ensure that the DNS A record for site.com and the CNAME record for www.site.com are properly set up in your DNS settings.
The A record should point to your server’s IP address, and the CNAME record for www should point to site.com.
You can use tools like dig or nslookup to verify DNS records:
dig site.com
dig www.site.com
If site.com is working but www.site.com is not, especially if it worked previously, the SSL certificate might be the issue. The certificate should be valid for both the www and non-www versions of your domain.
Check your SSL certificate status with:
sudo certbot certificates
This will show you for which domains the certificate is valid.
www.site.com is not included, you need to expand your certificate to cover both versions. You can do this with Certbot:sudo certbot --expand -d site.com -d www.site.com
Although your Nginx configuration looks correct, make sure there are no conflicting server blocks or other configurations that might be causing issues.
After any changes, validate your Nginx configuration and reload it:
sudo nginx -t
sudo systemctl reload nginx
www:sudo tail -f /var/log/nginx/error.log
www.site.com from a browser or using curl:curl -I http://www.site.com
curl -I https://www.site.com
By following these steps, you should be able to identify and resolve the issue with www.site.com. The key areas to focus on are DNS settings, SSL certificate coverage, and Nginx configuration.