Question
Successfully redirect non-www url to www url but site doesn't pull up (Ubuntu 14.04 Nignx LEMP)
Hi, I managed to successfully forward non-www to www address on my site. So if I type website.com it’ll automatically go to www.website.com.
However, the site doesn’t pull up anything. It shows error “Server not found” “Browser can’t find the server at www.website.com.” When I type in the IP address, it pulls up just fine.
BTW, I’m very newbie to using Ubuntu and building a server from scratch like this (DigitalOcean style), so any help is appreciated. I searched through articles and questions in Community section but none of the answers manage to get the site to pull up.
This is my virtualhost file setting:
server {
listen 80;
server_name website.com;
return 301 $scheme://www.website.com$request_uri;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/website.com/html;
server_name www.website.com;
............the rest of the code settings...........
...................
}
I then restarted nginx with
sudo service nginx restart
I also set up the DNS to be:
@ A 111.111.111.11
@ AAAA 1111:1111::1111:(the IPv6 address, basically)
www CNAME @
Help? Thanks in advance!
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.
×
I just pinged website.com and it pings correctly to 111.111.111.11
But when I pinged www.website.com it couldn’t find host www.website.com.
On a quick look, that all looks fine to me. DNS can take quite awhile to propagate completely. How long was it between the last time you tested it and the last time you changed the DNS entries?