What is a web server?

  • 5,000
  • Tác giả: admin
  • Ngày đăng:
  • Lượt xem: 5
  • Tình trạng: Còn hàng

By

  • Rahul Awati
  • Alexander S. Gillis, Technical Writer and Editor

A trang web server is software and hardware that uses HTTP and other protocols lớn respond lớn client requests made over the World Wide Web. Its main job is lớn display trang web nội dung, such as text, images, videos and applications, lớn users by storing, processing and delivering webpages. Web servers are also used in trang web hosting, i.e., the hosting of data for websites and web-based applications.

Computers that host websites must have trang web server software lớn be able lớn store, process and, most importantly, display trang web nội dung, lượt thích documents, images or videos.

A trang web server usually refers lớn hardware and software working together.

The trang web server hardware is connected lớn the mạng internet and enables data lớn be exchanged with other devices connected lớn the trang web. It is a computer that stores trang web server software and other files related lớn a trang web, such as Hypertext Markup Language (HTML) documents, images and JavaScript files, and is installed with trang web server software. The computer includes numerous components, including processor, RAM, high-capacity storage drive, and one or more network interface cards.

Web server software controls how a user accesses hosted files. Its primary function is lớn display the nội dung of hosted websites on a user's device, e.g., computer, điện thoại thông minh, tablet, etc. The software is accessed through the tên miền names of websites -- multiple domains can be hosted on one trang web server -- and ensures the delivery of the site's nội dung lớn the requesting user.

The trang web server understands trang web addresses, also known as URLs. Like trang web server hardware, trang web server software is also composed of several components. Also, most of them tư vấn and use HTTP lớn view webpages. Besides HTTP, some trang web servers tư vấn Simple Mail Transfer Protocol (SMTP) and File Transfer Protocol (FTP) for tin nhắn, tệp tin transfer and storage.

What are trang web servers used for?

Web servers often come as part of a larger package of internet- and intranet-related programs that are used for the following:

  • Building and publishing webpages.
  • Web hosting.
  • Sending and receiving emails.
  • Downloading requests for FTP files.

Some trang web servers also provide platforms for developing trang web applications, thus contributing lớn the growth of the web's global infrastructure.

How trang web servers work

The trang web server process is an example of the client-server model. In this model, a client -- usually an over user's device -- requests a server for some information. The server acknowledges the request and then provides the requested information lớn the client.

When a user's device needs a tệp tin that's hosted on a trang web server, it initiates the request via a trang web browser, such as Google Chrome or Firefox. The user types the URL of the site where the required tệp tin is hosted. The browser requests the tệp tin by HTTP. When the request is received by the trang web server, the HTTP server accepts the request, finds the nội dung and sends it back lớn the browser through HTTP.

Thus, when a browser requests a page from a trang web server, this series of steps plays out:

  1. The user specifies a URL in a trang web browser's address bar.
  2. The trang web browser obtains the IP address of the tên miền name -- either by translating the URL through the tên miền name system (DNS) or by searching for it in its cache. This brings the browser lớn a trang web server.
  3. The browser requests the specific tệp tin from the trang web server by an HTTP request.
  4. The trang web server responds, sending the browser the requested page, again, through HTTP. The browser is then able lớn display the webpage.
  5. If the requested page does not exist or if something goes wrong, the trang web server responds with an error message: 404 Not Found.

What is an example of a trang web server?

There are a number of trang web servers available, including the following:

  • Apache HTTP Server. Developed by Apache Software Foundation, it is a không tính phí and open source trang web server for Windows, macOS and Unix operating systems (OSes). Launched in 1995, the trang web server is secure and extensible, and it aligns with HTTP standards. In July 2024, the Apache Foundation released the latest version of the trang web server: Apache httpd 2.4.62.
  • Lighttpd. This flexible trang web server is designed lớn efficiently use the central processing unit and memory and includes features lượt thích FastCGI, Common Gateway Interface, authentication, output compression and URL rewriting, making it suitable for high-performance environments.
  • Microsoft Internet Information Services. Developed by Microsoft, IIS for Windows Server provides a scalable and open architecture lớn host websites and trang web applications. The trang web server is flexible and easy lớn manage and includes capabilities lớn securely publish trang web nội dung, delegate site configuration management, centralize trang web farm management, reduce server footprint, enable high-speed dynamic caching and compression, and deliver high-fidelity user experiences. Website owners can try IIS with a không tính phí trial edition of Windows Server.
  • Nginx. Pronounced "engine X," this popular open source HTTP trang web server is known for its light resource utilization and scalability. It provides automatic load balancing and high fault tolerance, and it accelerates reverse proxying with caching and supports Post Office Protocol 3, Internet Message Access Protocol and SMTP for authentication. In addition, it supports multiple protocols, including HTTP/2, HTTP/3, Secure Sockets Layer (SSL) and Transport Layer Security Server Name Indication.
Graphic of how HTTP works.
The Apache HTTP Server is one of several trang web servers lớn choose from. It's an open source cross-platform trang web server.

Dynamic vs. static trang web servers

A trang web server can be used lớn serve either static or dynamic nội dung. Static refers lớn the nội dung being shown as is, while dynamic nội dung can be updated and changed. A static trang web server consists of a computer and HTTP software. It is considered static because the server sends prewritten hosted files as is lớn a browser. Also, every user sees the same nội dung since the server only delivers the stored files. There is no server-side processing, database interaction or real-time generation of dynamic, user-specific nội dung.

A dynamic trang web browser consists of a trang web server and other software, such as an application server and database. It is considered dynamic because the application server can be used lớn update any hosted files before they are sent lớn a browser. The trang web server can generate nội dung by requesting it in real time from the underlying database. Also, this nội dung is delivered based on a user's specific input or other variables.

This makes it possible lớn deliver interactive features on the trang web, such as login forms and shopping carts. These features, generated dynamically and on the fly, can enhance user experiences. However, the increased flexibility of the process also makes it more complicated lớn design and implement.

Server-side scripting in trang web servers

Many basic trang web servers also tư vấn server-side scripting, which is used lớn employ scripts that lập cập on the server. The goal is lớn customize the response lớn the client's request and dynamically generate and deliver trang web nội dung in real time.

Server-side scripting runs on the server machine and typically has a broad feature phối, which may include database access, identity authentication, push notifications, etc. The server-side scripting process also uses Active Server Pages, PHP and other scripting languages. This process also enables HTML documents lớn be created dynamically.

Server-side scripting is useful because it enables dynamic nội dung generation. Its drawback is that it introduces a lot of latency because every request from every client has lớn travel lớn the server before it can be processed. For this reason, many trang web developers lập cập more code on the client side for modern trang web applications. Including client-side processes in the application architecture can reduce latency, while still displaying dynamic nội dung.

How lớn choose a trang web server

Site owners and administrators should consider numerous factors when choosing a trang web server, including the following:

  • What the trang web is used for and whether the trang web server can tư vấn those needs.
  • How well it works with the OS and other servers.
  • Its hosting environment.
  • Its ability lớn handle server-side programming.
  • Whether it can handle sudden spikes in workloads without impacting performance (scalability).
  • Security characteristics.
  • Publishing, tìm kiếm engine and site-building tools that come with it.

It's also important lớn kiểm tra whether the provider offers responsive customer tư vấn, frequent data backups and assurance of uptime above 99%. Web servers may also have different configurations and phối mặc định values. To create a high-performance trang web server, high throughput and low latency help.

Web server security practices

Comprehensive security practices can make for more secure trang web servers and safer trang web experiences for users. These may include the following:

  • Reverse proxy, which hides an internal server and acts as an intermediary for traffic originating on an internal server.
  • Access restrictions by limiting the trang web host's access lớn infrastructure machines or by using Secure Shell.
  • Patched and up-to-date trang web servers lớn minimize vulnerabilities and susceptibility lớn cyberattacks.
  • Network monitoring lớn detect unauthorized or potentially malicious activity.
  • SSL lớn encrypt sensitive data and make it inaccessible lớn anyone other than thở the intended recipient.
  • Firewalls lớn monitor HTTP traffic, block malicious traffic and malware, and ensure that only authorized users are allowed lớn access trang web resources.

Explore the differences between Tomcat vs. Apache HTTP Server and HTTP vs. HTTPS. Also, a DNS server resolves the hostnames of websites into Internet Protocol addresses. Learn how lớn troubleshoot common name resolution issues on Windows, Linux and macOS.

This was last updated in December 2024

Continue Reading About What is a trang web server?

  • Dive into the history of server hardware
  • HTTP request methods explained
  • Server hardware guide: Architecture, products and management
  • Types of DNS attacks and how lớn prevent them
  • Web 2.0 vs. Web 3.0 vs. Web 1.0: What's the difference?