Hi People,

I had installed nginx to a droplet with attached to my domain. But then I deleted that droplet.

And I created new droplet and everything works fine EXCEPT when I typed www.mydomain.com, it redirected to “Welcome to nginx” page instead of my actual page.

However, if I typed https://mydomain.com, http://mydomain.com, mydomain.com. they all direct to my actual page.

Is there any way to solve this?

Thank you so much.

3 comments
  • Create a CNAME record in your DNS for www. to domain.com.

    In nginx’s vhost config add www as second server name with server_name mydomain.com www.mydomain.com; .

  • @X40C

    I can’t create CNAME record in my DNS for www. to domain.com.

    It showed the followings:

    Digital Ocean –> CNAME records cannot share a name with other records.
    Cloudflare –> DNS Validation Error (Code: 1004): Content for CNAME record is invalid (Code: 9007)

    Any idea? Thanks.

  • In cloudflare, name should be “www” and content should be “yourdomain.com”.

Submit an answer

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