Why are the sites not accessible by ip address?

Why, if you type in the browser's search bar the ip address of the site instead of the url, it will not be available? If I'm not mistaken, the browser will not open the site by ip address, even if the site has a dedicated ip.

Author: Павел Игорев, 2017-09-21

1 answers

This depends on the server settings and the type of web server. Usually, if you do nothing specifically, and there is only one site on the server, then it will open at the IP address. It is not difficult to make it so that for unknown domains, and for requests without the Host header, some specially designed site opens with a single page with explanations.

For example, in the case of nginx, such a special site should be marked with the parameter default_server.

If we are talking about some kind of mass virtual hosting, then the usual practice is to do just that, that is, restricting access to the server by IP. No one wants to listen to complaints from a dissatisfied client whose site, which happens to be the first in the list, opens when you enter some other domain in the address bar, which for any reason points to the server's IP. The owner of that other domain will not be happy about this development either.

If your site works over HTTPS, then one server setting will be not enough. You will need to get an SSL certificate for both the domain and the IP address. The latter is not always possible.

 8
Author: sanmai, 2018-04-21 01:21:13