Report this

What is the reason for this report?

0curl: (6) Could not resolve host: mydomain.com after Redirect non-www to www with Nginx

Posted on December 4, 2018

I’ve followed a tutorial post about redirect on Digital Ocean’s community.

But things didn’t worked for me as in the tutorial.

Below is my server block code for redirect from config file /etc/nginx/conf.d/redirect.conf :

server {
    server_name www.crusadehimalaya.com;
    return 301 $scheme://crusadehimalaya.com$request_uri;
}

I’ve also added A record with **“www” ** and @

Running ```curl -I http://www.crusadehimalaya.com



% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 194 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0 HTTP/1.1 301 Moved Permanently Server: nginx/1.14.0 (Ubuntu) Date: Tue, 04 Dec 2018 07:45:15 GMT Content-Type: text/html Content-Length: 194 Connection: keep-alive Location: http://crusadehimalaya.com/


Running ```curl -I http://crusadehimalaya.com```
Gives following output:



% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0curl: (6) Could not resolve host: crusadehimalaya.com



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.

It’s most likely due to a DNS propagation issue. I’m getting good output now. So perhaps the issue you were facing subsided as propagation completed.

Cheers

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.