Answer the question
In order to leave comments, you need to log in
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.
78.46.72.113
Answer the question
In order to leave comments, you need to log in
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.
Why doesn't this work with a toaster?
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 questionAsk a Question
731 491 924 answers to any question