Block masking URL from nginx

Daniels Vitols asked:

Some bad person is masking my website with his domain www.baddomain.com. I would like to block it somehow from my nginx config file if that is possible.

I tried to see from “baddomain.com” source code if he is using URL frame, but can’t find one. Also domain extensions are being duplicated on every page.

I have filled Copyright Claim with his domain issuer but that could be long process or useless.

I own “original.com” but he owns “baddomain.com”. I don’t want google to think there is duplicate content with my site.

How could I block masking url from Ninx? I use DigitalOcean droplet, Ruby on Rails. Unicorn and Nginx for server!

My answer:


The reason this is happening is that the other domain name has the same IP address as yours. Since the last update to their DNS was in July of 2015, it appears that they simply have a defunct domain, and were the previous user of that IP address.

This is easy to resolve:

It appears that you’ve placed the configuration for your web site in the nginx default virtual host. This is not a recommended configuration.

Your web site should have its own server block, and the default server block shipped with nginx should be left unchanged.

To resolve the problem, restore the default server block to what was shipped with nginx, and place the configuration for your web site in a separate server block. In this way, accesses to any other domain directed at your IP address will be served the default nginx error page.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.