S
S
Senseich2018-04-09 22:54:03
Domain Name System
Senseich, 2018-04-09 22:54:03

How is a specific site determined on hosting if there is only one server IP?

Hello! Never delved into the intricacies of how the Internet works. I knew that each PC has its own IP and the site has its own IP (domain).
Asked such a question. On hosting, several sites are stored on one server, i.e. on a PC that has a unique IP.
How, when accessing different site addresses, are they determined on the server, completely confused? )

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Mystray, 2018-04-09
@Mystray

An HTTP client (a browser, for example) when requesting a page, among other headers, sends the header Host: in which, in fact, it indicates the domain name to which it is knocking. The server sees this header and processes accordingly.
In HTTPS (TLS/SSL) there is a special SNI field for this, which is used for the same.

M
Mysterion, 2018-04-10
@Mysterion

When the client enters the site address into the address bar in the browser, a request is made to the DNS server (or cache, if it has already been accessed before) and takes from there the address to which you need to walk, while the domain name remains in the HTTP request.
When a client request arrives at the server, the web server (which hangs on the IP address that DNS gave us) receives the domain name with which the client came and sends us to the virtual host directory of this domain and the result of the request is given there - the content site.
DNS here is, as a rule, the specified DNS servers in the network interface settings or the DNS servers of your provider.
NS servers are the hosting provider's DNS servers. They are needed in order to manage the domain name on the hosting where you create the site.
In order for your domain to lead somewhere, you need to create, for example, an A-record in the DNS zone settings indicating the IP address of the web server.
If you have registered a domain and decide to manage it yourself, you will have to manually create A-records each time with the desired name and address.
And if you want automatically, then delegate the domain to the hosting provider's NS servers and that's it. When creating a site with him, an A-record will be automatically created in the zone file of your domain.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question