What is web hosting ? How does web server work?
The Internet is a global network that connects a huge number of devices. Devices include not only stationary computers and laptops, but also mobile devices, cameras, various electronic and household appliances.
Although all these devices are completely different, they communicate with each other without problems using a single language. The TCP/IP protocol stack has become such a language in the world of machines. Without going into details, let’s say that a protocol is the rules by which communication takes place. However, the nature of the communicating devices is not important.
The main element in TCP/IP is the IP address. The IPv4 version looks like this: 10.123.23.1. Four numbers separated by a dot. All devices directly connected to the network have this unique address. In fact, any request on the Internet is always directed to some ip address, even if you don’t see it.
The modern world is obsessed with the Internet of Things (IoT). Statistics show that the number of devices connected to the network has exceeded the number of personal computers also connected to the Internet.
Among computers connected to the Internet, there is a class of machines that act as servers. These servers are usually hosted by hosters, and it is they who serve numerous Internet sites.
What is web hosting ? How does web server work?
A hoster that provides a service called hosting, that is, resources for hosting and maintaining a website on the Internet. Hosting can be very different, ranging from a completely ready-made environment into which the site code is uploaded to hardware servers that can and should be managed independently.
It usually works like this: After registering on the hoster’s website, a tariff is selected, a bank card is tied, and you are charged a monthly fee for maintenance and additional services. In return, you get access to your resources, for example, an IP address and a login/password pair for ssh or ftp access.
It is important to understand that regular hosting (they say, “shared”) is not suitable for everyone and not always. On the one hand, it is cheap and does not require configuration, on the other hand, it is very limited in resources and capabilities, including configuration. Serious solutions are still located on virtual or hardware servers provided by the same hosters. For the most complex systems, they build their own data centers, such as Google or Facebook.
It is important that shared hosting, as a rule, supports a very limited set of languages, most often PHP. Therefore, programmers outside the PHP world almost always prefer VPS Server Host.
Consider the last element – the domain. Where does the domain name come from, and how does it relate to where the site is located?
When the internet was in its infancy, sites didn’t have domain names. To access the site, direct IP addresses of machines (servers) were used, for example, 10.132.234.4 (instead of the understandable). It quickly became clear that it was too difficult to memorize. Besides, the addresses could change. Something like an address book was needed.
The first solution was a special hosts file located on each machine from which the sites were accessed. It contains a mapping between an ip address and a name that is easy to remember. This file still exists and is often used by programmers during development.
When a request is made to an address, the hosts file is checked first, and if the domain is found, then the browser establishes a connection to the server.
It quickly became clear that this approach was very ineffective. Each subnet used its own hosts file, which was sent to all computers included in the subnet. In addition, if a new site appears, then everyone needs to be notified. And there were too many sites themselves. The Domain Name System (DNS) was created to solve these problems. The main purpose of this system is to map a domain name to a specific IP address where the site is located. In other words, any service can go to the DNS.
What is the Domain Name System (DNS)?
It is important to understand that DNS is a service, not a specific server. Since the entire Internet depends on the stability of this system, it includes many servers around the world. In addition, DNS is designed in such a way that there is no central organization managing these servers.
How does Web Server Work?
For the most part, the web is built on a client/server architecture. This means that client programs make requests to server programs. For example, the browser is the client, and the program that responds to browser requests and provides site content (such as HTML and CSS) is the server. Specifically in the case of sites, it is called a web server.
When a browser requests a site, a so-called HTTP request occurs. This name is due to the fact that the request goes over the HTTP protocol, which we encounter in our lives literally every day. Right now, it doesn’t really matter how it actually happens. It is important that the browser has a way to go to the web server and tell us which site we want. And the web server, in turn, gives the site to the browser. “Serves the site” can be understood as the transfer of HTML in the form of text, from the web server to the browser.
Indeed, having received the content of the site in the form of html, the browser performs complex manipulations, the result of which is a beautiful picture on the screen.
What happens after you press enter in the field with the entered address?”
There is an exhaustive answer to this question . In short, the following happens:
- The browser makes a request to the DNS servers from which it learns the required IP address
- The browser establishes a connection to the web server, which is launched at the found address, using the TCP / IP protocols
- The browser makes an HTTP request
- The web server returns an HTML page for the specified address
- Browser renders HTML
Domains are issued by organizations called registrars. On their website, you can find an unoccupied domain and pay for it. After that, an extension is required every year, otherwise it will become free again, and others can buy it.Then, right there at the registrar, you can configure DNS, for example, specify the address of your hosting (in reality, everything is a little more complicated, you first need to specify the NS server) on which the site is located. After about a day, your site will start opening.
This period is due to the fact that information about the new domain-address link should be distributed to all DNS servers around the world. The same story happens when the IP address changes. The process can take up to a day.
Domain name registrars and hosters should not be confused. Often hosters act as resellers and offer to buy domains through themselves, but, in general, registrars are separate companies that have nothing to do with hosting.
One of the decisions you’ll have to make is choosing the most reliable virtual private server (VPS) hosting.
Read Related Article