V
V
VladVol2017-04-14 22:19:45
Nginx
VladVol, 2017-04-14 22:19:45

How to block a domain for a used ip address?

I bought a virtual server, they gave me an ip for it. While access to content is only through ip, dns has also been acquired.
The other day, I accidentally discovered in the nginx logs that they go to it from a certain domain. I typed in this domain in the browser - voila - my test page of the site!

This is the first server, so I don't understand if this is a normal picture when someone else's domain shows your site?
And how to forbid the server to give anything to this domain? Yes, in general, to any domains other than the specified one?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2017-04-14
@sim3x

Configure nginx so that it does not catch everything that climbs to it
nginx.org/en/docs/http/server_names.html#miscellan...
but catches only ip or domain name

V
VladVol, 2017-04-15
@VladVol

Looks like it should work, but it doesn't...

server { 
      listen 80 default;

      server_name noname;

      access_log /dev/null;
      error_log /dev/null;
      return 444; 
   }

server {
      listen           80 default_server;
      
      server_name      MY_IP_ADDRESS;

      root             /usr/local/www/;
      index           index.html index.htm;
   }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question