How to set up smartphones and PCs. Informational portal

How does a web server work? Web Application Basics

If you are interested in how this process is carried out or want to learn about the special mechanisms that allow you to surf the Internet, we recommend reading this article. From it you can find out how WEB server s deliver WEB pages into users' homes, schools and offices. So, let's begin!

Let's say a user is sitting at a computer, browsing WEB pages, and then a friend calls him and says:

“You know, I just read a cool article! Enter this URL and read for yourself. This is the page."

The user enters the dictated URL into and clicks the "Go" button. And lo and behold, no matter where this URL is located, the page appears on the monitor screen.

The following diagram is actually simple level gives an idea of ​​the sequence of events as a result of which the selected page appears on the monitor screen:

The user's browser connected to the WEB server and requested desired page and received it.

What happens unnoticed by the user

  1. The browser has split the URL into three parts:
  • Protocol (“http”).
  • Server name (“site”).
  • File name (“web server.htm”).
  • The browser contacted the name server and translated the server name " " into an IP address, which is used to communicate with the server machine.
  • Then the browser, using the received IP address, contacted the right server on port 80 (We’ll talk about ports later in this article).
  • According to the protocol HTTP browser sent a GET request to the server, requiring the file “/web server.htm” to be sent. (Note that the browser may send along with GET request cookies - see the article on how cookies work for details.)
  • The server then sent the browser the HTML text for the WEB page. (The page header sent from the server to the browser may also contain cookies.)
  • The browser counted HTML tags and displayed the page on the monitor screen. If you were not interested in the details of this process before, you will come across many new terms in the description. To understand the details of the entire process, you need to know what IP addresses, ports, protocols are... The meaning of these terms will be explained in detail below.
  • So, what is the “Internet”? - these are millions of computers connected into a huge computer network. Thanks to the network, computers can communicate with each other. Home computer can be connected to the Internet using a telephone line modem, devices operating on DSL technologies or cable modem. These devices communicate with your Internet Service Provider (ISP). Company or university computers are usually equipped with circuit boards network interface(network interface card, NIC), which connect them directly to the corresponding local area network (LAN). The company can connect its local network to the equipment of the Internet service provider using high-speed telephone line, for example, T1 line. A T1 line can carry approximately 1.5 million bits per second, while a regular line using a modem can only carry 30,000 to 50,000 bits per second.

    The Internet service provider communicates with larger Internet service providers, and the largest providers operate fiber optic backbones across a country or region. Worldwide backbones are formed using fiber-optic communication lines, submarine cables and satellite channels(some interesting maps Internet backbones can be found in the Cyberspace Atlas). This gives every computer connected to the Internet the ability to communicate with every other computer on the Internet.

    Clients and servers

    IN general case All machines on the Internet can be divided into two types: servers and clients. Machines that provide services to other machines are called servers (for example, WEB servers or FTP servers). The machines used to communicate with servers to obtain services are called clients. When a user connects to Yahoo! to yahoo.com to view the page, Yahoo! allocates a machine (or perhaps a cluster of very large machines) for use on the Internet to service that user's request. So Yahoo! provides the user with the services of its server. The user's machine, on the other hand, is likely not providing services to anyone else on the Internet. Therefore, it is called a user machine, or client. It may be true, and it is common practice, for one machine to be both a server and a client, but in our case we will assume that most machines perform the functions of either a server or a client.

    A server machine provides one or more types of services on the Internet. The server machine can run specialized programs, thanks to which it can perform WEB functions servers, servers Email And FTP servers. Clients connecting to the server machine are chasing a specific goal, so they forward their requests to the server with the appropriate specialized program, running on a shared server machine. For example, if a user on his machine runs WEB browser, he will most likely contact the WEB server on the server machine. Custom Application, using the Telnet protocol, seeks to establish communication with Telnet server, the email application makes contact with the email server, and so on...

    Domain names and their purchase

    Due to the fact that it is difficult for people to remember the set of numbers that make up an IP address, and with the need to sometimes change addresses, all Internet servers are also assigned easy-to-read names, which are called domain names. Most people find it easier to remember the name of a website than an address 209.116.69.66.

    The site name consists of three parts:

    • Hostname (www).
    • Domain name (sd-company).
    • domain name top level(ru).

    Registrars

    Domain names within a domain .com handled by the VeriSign registrar. VeriSign also controls domain names .net. Other domains (such as PRO, BIZ and ORG) are managed by other registrars (namely RegistryPro, NeuLevel and Public Interest Registry). VeriSign creates top-level names and ensures that all names within the top-level domain are unique. In addition, VeriSign contains contact information each site and has a database of users. The hostname is created by the company providing the domain. The host name "www" is very common, but many places now either omit it or replace it with another host name that points to a specific location on the site. For example, in the domain name of the Encarta encyclopedia Microsoft,encarta.msn.com, “encarta” denotes the hostname instead of www.

    In order for all these machines to work correctly, each machine on the Internet receives a unique address called an IP address. IP supports the Internet Protocol, and addresses are 32-bit numbers that are typically represented as four "octets" in "dotted decimal format." A typical IP address looks something like this: 216.27.61.137

    The four numbers in an IP address are called octets because they can have values ​​from 0 to 255, which is 2 to the eighth possibilities per octet.

    Unique IP address

    Every machine on the Internet is assigned a unique IP address. Servers are assigned static IP addresses that are rarely changed. Home computers that connect to the Internet are often assigned an IP address by their Internet service provider at the time of connection. This IP address is unique during this session - the next time the machine connects, it may be assigned a different address. This way, the ISP only needs to allocate one IP address to each modem while it is online, rather than having separate addresses for each client.

    A user whose machine is running Windows OS can receive a large number of information about your computer's Internet connection, including the current IP address and host name, if you use the WINIPCFG.EXE command (IPCONFIG.EXE for Windows 2000/XP). On a UNIX machine, to find out the machine's IP address, you need to type in command line nslookup, as well as the name of this machine, for example, SD 1 - that is, all together it will look like this: “nslookup sd1.su”. You can determine your machine name using the hostname command. (More details IP addresses can be obtained from the Internet Digital Addresses Committee).

    A machine running on the Internet usually only needs an IP address to communicate with a server. For example, you can type URL 209.116.69.66 in your browser and contact the machine on which the WEB server of the PCWork site is located. To communicate with some servers, an IP address alone is not enough, but for most large servers this is quite enough - this issue will be covered in more detail later.

    The Internet has burst into our lives at tremendous speed. He has tamed everyone to himself, entangled him in his web and is not going to let us go. Scrolling through dozens and hundreds of pages of websites every day, few people think about what this global network The Internet, how it works, what these or other terms mean. Today is our we'll talk about what a web server is, what it is needed for, what functions it performs.

    What is meant by the term web server? A collection of web servers is the basis of the Internet. If it weren't for them, there wouldn't be world wide web. Users simply would not be able to communicate with each other, find the information they need, or create and maintain their websites and blogs. Web servers can be computers or special programs, which act as a server.

    Web server functions

    The main task of the web server is to accept HTTP requests from users, process them, and convert them into digital computer code. Then issue HTTP responses, converting them from millions of zeros and ones into images, media streams, letters, HTML pages.

    Any web server, for ease of use by users, must have a convenient web browser. It sends requests to the web server, converted into URLs of Internet resources.

    Along with standard features, some web servers have additional ones. So, for example, the corresponding software can record the number of user requests to a particular resource and record them in a separate log. They can also support HTTPS, which is important for a secure connection between sites and users. Often a web server is installed along with a mail server. This allows users to quickly go to the mail page directly from the site by clicking just one hyperlink.

    What is a web server for?

    As is already clear from the above, a web server is needed by everyone who uses the Internet to exchange information. However, you have to contact him by and large not to humans, but to programs and devices. For example, antivirus programs They often ask to find a server on the network and update their databases. Actively collaborate with web servers Cell phones, TVs and other devices that have Internet access. In this case, programs can be configured to automatic update. Then user participation in this process will be practically unnecessary. But it is still better to control some updated databases yourself.

    The most famous web servers

    The most famous and widespread web servers are Microsoft IIS and Apache. The most popular of them is Apache. Its software is used by more than 60% of all existing ones. This is largely possible due to the fact that Apache is free. Developers constantly analyze the errors of their product and eliminate them. The disadvantage of the program is that, by and large, it is intended for professional programmers and users, so it is quite difficult to maintain and configure it.

    Microsoft, on the contrary, has its own web IIS server strives to make it understandable to the average user. All its settings can be done without specialists. It is quite possible that this program will be able to catch up with its competitor with an Indian name in terms of the number of users.

    Both Apache and IIS work perfectly with many operating systems, for example Mac OS, Linux, various modifications Microsoft Windows and many others. These two web servers are stable in operation and have good speed, you can connect additional modules to them.

    The web hosting industry requires at least,some basic knowledge to work. There are several web hosting terms that every webmaster should be aware of. One of the most basic ones is: web server In reality, web hosting is made up of web servers that provide space for your website. The HP Micro AMD N40L Server is a versatile server that can provide a platform to organize and protect business information, enable effective customer communication, and make the most of your existing office equipment and resources. The HP MicroServer is a cost-effective starter server for businesses with fewer than 10 clients, and it can take your business to new level performance and efficiency. To learn more about the HP Micro AMD N40L Server, please follow this link http://vint.com.ua/product/computers/dir_3010558/dir_3010559 .

    Web server can mean two things - computer, which hosts the website and program, which runs on such a computer. Therefore, the term related to the web server both hardware and software . We will look at these two types one at a time.

    Web server hardware

    The website is a collection web pages which represent digital files, which are typically written using a markup language HTML hypertext. The website will be available to the whole world all the time; for this it must be stored either on a hosting or on a computer connected to the Internet 24/7/365. Such a computer is called Web Server (note the first letters are uppercase).

    You can potentially host a website on your home computer, but this requires a lot of work and constant monitoring. It's easier to buy web hosting from a company because there are thousands of them that offer this service at reasonable prices. Briefly about one of the best companies at the end of the article you can not only get web hosting, but also a domain name and website and it's really cheap!

    There are a number of requirements for a computer server - it must be fast enough, have large volume random access memory And HDD with a large volume. But the most important thing is to have Permanent Address to the Internet, also known as an IP - Internet Protocol address. If the IP address of the website is not found and it will work V offline mode - the browser will display an error can't find website.

    Web server programs and software

    Programs web server This is software that runs a website on a hosting server computer. Its main goal: issue web pages; this means that it listens for requests from web browsers (also known as clients ) and responds by sending the necessary data back. This client-server interaction is a distinctive part of how a web server operates..

    There are many web server programs. The most famous and popular of them is Apache, developed by the Apache Foundation. Apache is not only free, but it is also available for several operating systems, including Windows, Macintosh and Linux/Unix.

    We released new book"Content marketing in in social networks: How to get into your subscribers’ heads and make them fall in love with your brand.”

    Subscribe

    A web server is a server that accepts requests from the user and provides them with responses - a document, page or site.


    More videos on our channel - learn internet marketing with SEMANTICA

    Any computer can be turned into a server. To do this, you need to install a special shell.

    Requirements for the technical part are determined by the number of allocated resources and speed requirements. The larger they are, the more powerful the computer should be.
    To make it clear, let's give an analogy. You go to the library and ask them to give you a book. The librarian finds the one you need and gives it to you. The library is a server; all data is stored in it. The librarian is the shell that accepted the request and sent the response. You are the client.
    You can send a librarian for additional information– similar to clicking on a link. The difference is that the same resource on the Internet can be read by an unlimited number of users simultaneously.
    Customer service follows a similar principle: when we come to pick up a book, we can ask the librarian a question ( search system) or look at the index (Yandex Catalog). This helps you find the information you need.

    What does a web server do?

    His the main task- data storage. Pages, files, images, text content.
    Tasks:

    • Receive requests.
    • Run programs on special languages programming (server).
    • Create web pages.
    • Send them back to the user.
    • Protect information.
    • Identify visitors.
    • Keep a log of requests.
    • Serve requests of other types: mailto, etc.

    To understand how a web server works, you need to have an understanding of the principles of information transfer on the network. It is based on rules called protocols: any URL begins with an indication of the type (ftp, http://, https://, etc.).
    Hyper Text Transfer Protocol - transfer protocol. Site pages are always in the form of a hypertext document. This is the end result of any server or client program.

    • When a user enters an address or clicks a link, the browser makes a request by encoding the information according to these rules.
    • The host to which this address is bound runs server programs. Each of them performs its own functions.
    • The received data is decrypted and the commands are executed.
    • Hypertext is generated, encoded and sent back.
    • The browser receives the response, converts the code to html and displays the page on the screen.

    What is needed for a web server

    We need a machine that will process all requests. Estimate the load that the server must withstand. It depends on the number of visitors: the more requests, the more power is required.

    Eat special companies who provide hosting services. You are renting the server. You are given a quota for hosting site files.
    But if you have a simple website, then you can do it on your own.

    When the issue with the server is resolved, you need to bind to it static IP address.

    The site becomes available on the web server after it is registered Domain name, address translation completed DNS service- linking an IP address (for example, 111.111.111.111) and a domain name (www.site.com).

    Most common servers

    Apache

    This is a free, freely distributed product that has many advantages:

    • Constant developer support.
    • Modules for working with server-side languages PHP programming, Perl, Python, Ruby, ASP, etc.
    • Open source. Various programmers are engaged in modifications to suit their needs. For example, the Russian-speaking community adapts it to Russian encoding.
    • . Originally created for Unix, but now supported by Windows, Mac OS, BSD, Linux, OS/2 and Novell NetWare.
    • Safety.

    During installation, specify your host name, for example, localhost. Copy any html page to the htdocs folder, which is inside the Apachex.x folder (where x.x is the version number). Or create it in Notepad by entering any text and saving it with the html extension.

    When the file appears in the folder, open your browser and type the address: localhost://PAGE NAME.html. Your text will appear on the screen - the page is opened from the server. If you see the error “Cannot access the site,” it means Apache is not running. Its icon is in the tray.
    Click on it and select "Play". After this everything will work.

    NGNIX

    The share of active sites operating on it is 21.13% (Netcraft research). It is mainly used large companies and professional developers: Yandex, Mail.ru, Rambler, etc. NGNIX can withstand a huge load of visitors, is reliable, secure and thoughtful.
    Distributed freely, but paid ones have appeared Plus versions, cost from $2,500.

    IIS

    Its fame is ensured by the famous name of the developer. It is a set of web services and is integrated with Windows. The native programming platform is ASP.NET, but an alternative such as PHP can be implemented.

    For full hosting, you need to install a server operating system from Microsoft - Windows Server. The 6th version was not intended for hosting at all; full support began in the 7th. It is purchased automatically along with operating system and depends on its characteristics.

    Installation packages

    For novice programmers and developers, tools are being created that allow you to deploy a web server on your computer in a few clicks.

    • OpenServer. Portable development environment that includes many databases, programming languages ​​and their versions, as well as additional services. For example, the interface for working with the PhpMyAdmin database. Today this is the most popular installation kit. It even works from a flash drive. Free download at low speed. For 100 rubles the speed increases significantly.
    • Xampp. Actively supported package: Apache, Php, Perl, MariaDB, etc. Has a control panel. Download for free.
    • . Very convenient set everyone the right tools, including Apache, PHP, MySQL, PhpMyAdmin. Unfortunately, latest version includes legacy distributions. In general, they are also suitable for training. Judging by the forum, the project is no longer supported.

    In this article, we'll learn what web servers are, how they work, and why they're so important.

    Introduction

    The term “web server” can refer to both hardware and software. Or even both parts working together.

    1. From a hardware point of view, a “web server” is a computer that stores site files (HTML documents, CSS styles, JavaScript files, images, etc.) and delivers them to the device end user(web browser, etc.). It is connected to the Internet and can be accessed through a domain name like mozilla.org.
    2. From a software point of view, a web server includes several components that control web users' access to files hosted on the server, at a minimum - this HTTP server. An HTTP server is a piece of software that understands (web addresses) and HTTP (the protocol your browser uses to view web pages).

    Actually basic level When a browser needs a file hosted on a web server, the browser requests it through the HTTP protocol. When the request reaches the desired web server (hardware), the HTTP server (software) accepts the request, finds the requested document (if not, reports an error) and sends it back, also via HTTP.

    Static web server, or stack, consists of a computer (hardware) with an HTTP server (software). We call this "static" because the server sends the hosted files to the browser "as is".

    Dynamic web server consists of a static web server and an additional software, more often application server And Database. We call it dynamic because the application server changes source files before being sent to your browser via HTTP.

    For example, to produce the final page you view in a browser, the application server might populate an HTML template with data from a database. Sites like MDN or Wikipedia consist of thousands of web pages, but they are not real HTML documents - just a few HTML templates and giant databases. This structure simplifies and speeds up web application maintenance and content delivery.

    Active learning

    No active study available yet. .

    Let's dive deeper

    To load a web page, as we said earlier, your browser sends a request to the web server, which proceeds to search its own memory space for the requested file. Having found the file, the server reads it, processes it as needed, and sends it to the browser. Let's look at these steps in more detail.

    File hosting

    First of all, the web server must contain the website files, namely all HTML documents and associated resources, including images, CSS styles, JavaScript files, fonts and videos.

    Technically, you can host all of these files on your computer, but it's much more convenient to store them on a dedicated web server that:

    • always up and running
    • always connected to the Internet
    • has a fixed IP address (not all providers provide a static IP address for home connections)
    • serviced by a third party company

    For all these reasons, finding a good hosting provider is a key part of building your website. Review the many company offers and choose one that suits your needs and budget (offers range from free to thousands of dollars per month). You can find details in

    Once you have solved your hosting problem, all you need to do is upload your files to your web server.

    HTTP communication

    Secondly, the web server provides HTTP support. H yper t ext T transfer P rotocol - hypertext transport protocol). As the name suggests, HTTP specifies how to transfer hypertext (i.e., linked web documents) between two computers.

    A protocol is a set of rules for communication between two computers. HTTP is a stateless, text-based protocol.

    Text All commands are simple human-readable text. Doesn't save state Neither the client nor the server remembers previous connections. For example, by relying only on HTTP, the server will not be able to remember the password you entered or what step of the transaction you are at. For such tasks, you will need an application server. (We will focus on these technologies in future articles.)

    HTTP sets strict rules for the interaction between client and server. We'll look into it ourselves HTTP protocol in the technical article a little later. For now, it’s enough to know these rules:

    • Exclusively clients can make HTTP requests, and only to servers. Servers are only capable of responding to HTTP client requests.
    • When requesting a file via HTTP, the client must generate a file .
    • Web server must answer for every HTTP request, at least an error message.

    On a web server, the HTTP server is responsible for processing and responding to incoming requests.

    1. When receiving a request, the HTTP server first checks whether the resource exists at the given URL.
    2. If so, the web server sends the contents of the file back to the browser. If not, the application server generates the required resource.
    3. If none of this is possible, the web server returns an error message to the browser, most often a “404” Not Found" (This error is so common that many web designers spend a large amount of time designing 404 error pages.)

    Static and Dynamic Content

    Roughly speaking, the server can serve static or dynamic content. "Static" means "served as is." Static websites are the easiest to make, so we suggest you make your first website static.

    "Dynamic" means that the server processes the data or even generates it on the fly from the database. This provides greater flexibility, but is technically more difficult to implement and maintain, which makes the process of creating a website very complicated.

    Let's take the page you're reading now as an example. On the web server where it is hosted, there is an application server that retrieves the content of the article from the database, formats it, adds it to HTML templates, and sends the result to you. In our case, the application server is called Kuma, it is written in the Python programming language (using the Django framework). The Mozilla team created Kuma for MDN's specific needs, but there are many similar applications, built on completely different technologies.

    There are so many application servers out there that it is quite difficult to suggest just one. Some application servers are tailored for specific categories of websites, such as blogs, wikis, or online stores; others, called CMSs (content management systems), are more versatile. If you're building a dynamic site, spend a little time choosing a tool that suits your needs. If you don't want to learn web programming (although it's fun in itself!), then you don't need to create your own own server applications. This will be the invention of another bicycle.

    Next steps

    Now that you are familiar with web servers, you can:

    • read how difficult it is to do anything on the web
    • learn more about the variety of software that can be useful for creating a website
    • move towards practice: for example, .

    Best articles on the topic