S
S
sorry_i_noob2018-11-15 19:50:03
Computer networks
sorry_i_noob, 2018-11-15 19:50:03

Why can't I access some sites by ip?

Hello. I'm wondering why some sites cannot be accessed by ip? For example, here, on toster.ru.
I entered ping toster.ru on the command line and I got ip. I entered it into the address bar of the browser and received a message:

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.

Thank you for using nginx.

If you try to enter this ip: in the address bar of the browser,
78.46.72.113
then someone's site opens. Why doesn't this work with a toaster?
In general, I wonder if it is possible not to buy a domain, but to connect ONLY by ip?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrew, 2018-11-15
@sorry_i_noob

One IP can have many domains. All of them are determined by the web server.
When we send an http request to toster.ru , we connect to the IP address, and pass the domain name in the host header , the web server looks for a config that matches this domain name and transfers control to this config.
https://nginx.org/en/docs/http/server_names.html
When we connect by IP address, the IP address is transmitted in the host header , the server cannot find the config for this host and starts the default one with the nginx page.

A
Alexander, 2018-11-15
@zkelo

Why doesn't this work with a toaster?

Because several sites are sitting on the Toaster IP address (most likely), and if you connect by IP, you will see a stub page.
Can. Provided that you have a dedicated IP that will host only your website.

V
Vladislav Klimanov, 2018-11-15
@ahmpro

One ip can have several domains. The HTTP protocol has a Host header, based on which the web server displays a particular site. (or redirect traffic).
In this case, the administrators considered that when accessing by ip, nothing should be shown.
You can not buy domains and connect to your projects only via IP, but this is less convenient, it’s banal when you change the server, ip will change and wherever you have ip specified, you will have to change it, and if you have a domain, just change the record and wait for the zone to be updated :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question