C
C
Cloveron2020-07-31 12:52:00
Network administration
Cloveron, 2020-07-31 12:52:00

Why can I access a site by its domain but not by ip?

For example, there is a site
And I found out its ip on the site =

185.253.217.248

But when I try to navigate by ip, I get to the cPanel page. 5f23e9883b2e7003785472.png

Who can enlighten or tell what to read information about?
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Sokolov, 2020-07-31
@sergiks

When you enter an address in a browser, something like this happens:

  1. the browser translates the name into an ip address and connects to it.
    When you entered ip instead of the name, it is immediately clear where to connect.
  2. the web server is there. After connecting, the browser greets the server using the HTTP protocol and says what it needs. This, in general, is similar to a regular text chat. The browser writes first:
GET / HTTP/1.1
Host: web.site.com
Accept-Language: ru
Pay attention to the title Host- here is the address (without further path /a/b/c/index.php) that was entered in the browser. If you entered exactly ip, it will be there in the header Host.
Now it's up to the server how it is configured. Often on one server, on one ip, there are several sites. And the server understands which site was requested, precisely by the header Host.
It is quite possible to configure the web server, what to do when the Hostip-address is in the field: to give some kind of stub, or the main, the only site.

V
Vladimir Korotenko, 2020-07-31
@firedragon

One ip can correspond to an unlimited number of hosts. Read about the host header and dns

S
Saboteur, 2020-07-31
@saboteur_kiev

You need to read about virtualhosts A
webserver can support several sites, and by domain it can understand which one should be shown to the user.
The IP opens either a thread of the site specified by default, or a stub - depending on how the web server is configured

C
CityCat4, 2020-08-03
@CityCat4

Are you sure that there is exactly one site? There may be a thousand of them - and all on the same IP ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question