-2

So, I had my webserver running fine, I like non-www domains so I would leave non-www active, but whenever user would type www, they could also access the non-www version normally.

Then I created a subdomain http://blog.example.com. Now all traffic that goes to www.example.com load blog.example.com instead of example.com

I'm using nginx on digital ocean.

What can I do to fix this?

0

There is a lot of stuff going on behind the scenes that determines which domain will load by default in an nginx installation. The easiest way to address you issue is to have the "server_name" directive set properly in your config file for example.com. Something similar to the following should address your issue:

server_name example.com www.example.com

This will tell nginx to load the specific example.com configuration for both the www and non-www domains.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.