#
#
#yamynginx2020-11-07 10:00:20
Nginx
#yamynginx, 2020-11-07 10:00:20

How to reset the connection when connected by IP?

There is an A-record in DNS (A test.ru 1.2.3.4). Of course, the IP of the server is scorched there. I would like to turn a thing around:
If the client connects via a domain (test.ru), then some content is displayed, but if he tries to connect via IP (1.2.3.4) - reset the connection. Maybe it can be done via nginx with some error code? It is desirable, of course, to actually reset the connection.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
ky0, 2020-11-07
@muxui

You can make a separate server block that will handle connections by IP address, not by domain. It is configured in the same way.

H
hint000, 2020-11-07
@hint000

It seems that this question has already been asked dozens of times here and on other sites.
https://www.google.com/search?q=nginx+virtual+host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question