An unknown domain serving contents of my sites

Timothy Lee asked:

I found that an unknown domain like www.aaa.com serving exactly the same contents (html, js ,css, any asset) of my site: myname.me.

enter image description here

And the API as well, for example, www.aaa.com/api/user get the same response as myname.me/api/user.

How can I block this domain from serving my thing?

How does it make this, redirect directly to my domain? Proxy? DNS?

I use VPS and I use nginx, here my nginx config,
This is the redirection to https:

server {
    if ($host = example.me) {
        return 301 https://$host$request_uri;
    }

    listen 80 default_server;
    listen [::]:80 default_server;

    server_name example.me;
    return 404;
}

This is the proxy from https request to my application running on port 3000:

server {
    root /var/www/html/example
    server_tokens off;

    index index.html index.htm index.nginx-debian.html;

    server_name example.me;
    # add_header Cache-Control no-cache;

    location / {
        # First attempt to serve request as file, then as directory, then fall back to displaying a 404.
        # try_files $uri $uri/ =404;
        proxy_pass http://198.51.100.1:3000$request_uri;
    }
}

My answer:


Your description says that another domain name you don’t own has been set to your IP address, and web visitors to that domain therefore see your site.

To fix this, you need to restore the default nginx server block which shipped with nginx (or in this case, Ubuntu’s custom version of the default server block). This default server block does not serve anything by default; everything reaching it gets the Debian “welcome to nginx” page. You should have separate server blocks for your own sites.


View the full question and any other answers on Server Fault.

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