In this article, we give an overview of web servers: their definitions, functions and purposes. A term web server used differently and sometimes it means hardware, or physical devices, or it can be related to software tools and programs, or be a combination of both of them working together.
A web server as software includes programs that help users to reach the files stored remotely. At elementary level, we can expect at least HTTP server. The HTTP server has software that reads web addresses and exchange data between websites and user’s devices by means of HTTP (a protocol that helps to display web content). Access to the HTTP server and delivery of website content to the user is administered through the domain name (hostry.com, for example).
At the bottom, when a browser requires a file stored on a web server, it is requested through HTTP. When the request comes to the intended web server (a physical device, computer), the HTTP server (a program) receives the request, finds the corresponding file and sends it back, again using HTTP. If the page is not found, the server reports an error.
There are a huge number of different resources on the Internet and each website mostly consists of HTML pages that are divided into static web pages and dynamic web pages.
What is static websites
A static website is a network resource that includes static web pages (html, htm, dhtml, and xhtml) that form a single whole. It contains HTML tagged texts, images, multimedia content (audio and video files), and HTML tags. The tags are divided into service tags, intended for the browser, and those that are intended for website coding, placement, and displaying content. All changes to the static website are made by rewriting a basic source code (of the pages), for which you must have access to the files on the web server.
Pages of static websites are stored on the server as HTML files. Coding of static web pages is done manually. If you need to change the content of the page, you have to edit the HTML code for each page.
As a rule, a static website contains one or a small number of pages, or it can be a business card website of a company with never changing or rarely updated information. This type of network resource does not feature registration service, commenting, etc.
In fact, a static website can be updated only by a qualified web developer, because it does not have an administrative panel, so all the updates of the project can be done only through its source code.
Static websites are cheaper and take up less space on the website hosting, that causes small companies still to prefer them against dynamic websites.
The advantages of static websites include:
- Easy and quick to develop
- Cheap to develop
- Minimum system load
- Fast loading
- Not demanding to hosting resources
- Easily transferred to another hosting server
Along with the advantages, static websites have some disadvantages as well:
- To update the project, you have to be a web developer. To update even the smallest detail on the resource of this type, you either have to rewrite the HTML and CSS codes yourself, or you need to hire a webmaster every time.
- Stagnated content. The rarely updated content of static websites affects negatively their promotion in search engines and prevents the increase of incoming traffic. Of course, such resources also can be promoted, but mostly for money.
Also, static websites are not advisable for large projects.
Hence, it is obvious that if you have only an html-page on the server, you are functionally limited. For example, you have an online store to which you need to add a new product. If the online store consists of static web pages, then you need to correct several other pages manually. At a minimum, that is a product catalog and, apparently, an order form. And, if any product has been discontinued, then, again you need to update the static website, which is really inconvenient. In this regard, it is difficult to find an online store on the Internet that uses pure HTML code.
Dynamic web sites
A dynamic website is a network resource consisting of dynamic pages such as templates, content, scripts, and other elements, in the form of separate files. A dynamic web page in the user’s browser is formed on the server by request from a template page and separately stored content (texts, scripts, etc.). As a rule, to display any number of pages of the same type, one template page is used into which the related content is loaded, which allows you to adjust the appearance of a dynamic website (on all of its pages) all at once by editing only one template.
Dynamic pages are formed by the web server from several files (templates). All information is usually stored in a database. Almost all blogs are dynamic sites. When a user requests a page, the corresponding information is retrieved from the database, inserted into the template, forming a web page, and sent by the web server to a user’s browser. Thus, to update the contents of a dynamic web resource, you just need to add text for a new page, which then comes into the database. That is how the dynamic website kind of updates itself.
The advantages of dynamic websites are:
- The resource is more efficient for content management is carried out through special forms that allow you to easily add, edit, and delete information.
- Adding or editing content does not require a qualification in web development (HTML, CSS-codes).
- A dynamic webpage changes in response to a visitor’s actions.
- Suitable for large multi-functional projects.
- Dynamic web pages are much easier to modify and update.
- Separate storage of information and design templates allows you more flexible management.
- The constant updating of dynamic websites provides great opportunities for promotion, which makes the project easier for marketing and attracts more visitors.
Along with the advantages, dynamic websites have some weaknesses:
- You need additional software, which is reflected in a higher cost of creating and maintaining dynamic web pages.
- Increased hardware requirements for web servers. This problem is especially tangible for dynamic websites with high traffic.
- Accordingly, hosting will also cost more, since the project requires some additional features.
- Difficulties when you need global structural editing of dynamic web pages. In this case, you are dependable on the software that is used by the resource. Any program has its own limitations, to bypass which you need to change the program, modify the old one, or look for a new one.
- You need to have enough expertise to maintain dynamic pages.
Dynamic websites do not only bring forth new requirements for their creation and maintenance, but they are also much more expensive to develop and require a full-time programmer in your team. At the same time, it should be noted that the technologies do not stand still, so the ways of creating dynamic web pages are developing too, and one of the ways found was creating high-quality resources based on CMS.
CMS stands for Content Management System. Simply put, that is the software that allows you to change the design and edit the content of dynamic web pages according to the user’s requirement.
Currently, there are many CMSs on the Internet, and some of them are free, while others are not. Often, those systems are delivered to the customers by web development companies. Each system is individual and has its own advantages and disadvantages.
Thus, dynamic websites are much more flexible to manage than static ones. Dynamic web pages are a collection of texts and visuals and a markup language – just like static websites. However, on top of that, dynamic web pages also use various technologies that allow you to build web pages “on the fly”. Such resources help their owners to create a community of visitors and give much more opportunities to communicate with their audience, which allows making their own resource more interesting for visitors with help of various functions.
Dynamic web resources can be developed from scratch by creating all the necessary program codes, scripts, etc. manually. However, much more often, CMSs are used for creating dynamic web pages. A CMS allows you to use ready-made software modules and components and not to create them again many time. On the basis of the only CMS, you can create as many projects as you need.
At the same time, despite the obvious advantages of dynamic web pages, do not think they are the universal solution and you should completely forget about static web sites. You should always consider depending on the situation. Often, is better to use static web pages. In case of a small project consisting of only a few pages with the content that does not require to be updated often, then there is no point in creating an engine for the resource – it is easier to build the website once. But there are also cases when it is not possible.
Web site files
You can purchase a VPS or a dedicated server depending on the complexity of your website and requirements to the server based on a number of files, the size of a database, an application server, and presumed traffic to your web server.
HTTP data transfer
HTTP (Hypertext Transfer Protocol) is used to exchange information, using the client-server model. A client sends a request, the server processes and analyzes the request, and, then, creates a response and sends it to the user. At the end of this process, the client generates a new command, and the whole cycle repeats. Thus, the HTTP allows exchanging information between various user applications and web servers, as well as connecting to web resources (usually, browsers).
The HTTP determines rules for interchange between a server and a client. It is written as a text that can be read by people. This protocol is often called stateless as both communicating computercan not remember the state of the previous connection. Briefly, the server based on HTTP does not remember neither entered passwords no at which stage of the transaction you are on. An application server us normally used for that.
HTTP sets strict rules for the client-server interaction:
- The request is always generated only by clients, and only to servers. Servers answer to HTTP requests initiated by clients.
- To get a file through HTTP, the client has to send the URL of that file.
- The web server should respond to HTTP requests every time. If the requested file cannot be found the server returns an error message.
The HTTP server serves incoming requests and responds them.
- When a request is received, the HTTP server first checks if any file corresponds to the requested URL.
- If it does, the server sends the content of the file back to the client. If it does not, the file is generated by the application server.
- If none of the above is possible, the web server sends an error message to the client (404 Not Found).
Mostly Used Web Servers
Nginx and Apache are most demanded open-source web servers used to host websites around the world. Their share is more than 50% of all Internet traffic. Both programs offer all the necessary features and are able to withstand heavy workloads and integrate with other software to provide a full-fledged web stack.
Apache and Nginx have many characteristics in common, but they are not equivalent. Both programs have its own functions that suit better for particular situations.
Designed by Apache Software, this web server is now one of the most favored programs. After it was launched in 1996, Apache has been used by majority of users on the Internet. Thank to this popularity, Apache server has a lot of manuals and instructions and comprehensive support from third companies.
Administrators often choose Apache because of its flexibility, capability, and integration with numerous products. It can be expanded through dynamically loaded modules and allows you to support a large number of interpreted programming languages without connecting extra software.
Released in 2004, Nginx solves the problem of ten thousand connections, thanks to the implementation of the architecture based on asynchronous events.
It is lightweight, low resource consumptive and able to scale on different hardware, which made Nginx almost immediately gain immense popularity. Nginx performs highly effective when serving static content and transmitting dynamic requests to other programs.
Nginx is usually preferred by administrators for efficient use of resources and reliable work under heavy load. It combines the basic features of web servers and proxy servers.
Combining Nginx and Apache
You can use Nginx and Apache together to leverage the strengths of both of them. The traditional configuration is to place Nginx before Apache. Nginx processes all requests from clients and very quickly gives out static files without overloading resources.
For dynamic content, such as PHP, Nginx acts like a proxy server and sends requests to Apache. Then the result is returned to the client.
This configuration is great for many people, because Nginx works as a sorting service. Nginx protects Apache from overloading. Also, as needed, you can add multiple internal servers with Nginx acting as a pool.