Web Servers

Web Servers

How do Web Server really work?

ยท

4 min read

A web server simply put is really just a piece of software that serves web content.

The main job of a web server is to display website content by storing, processing and delivering webpages to users.

A web server does the following in this specific order:

  1. Listens
  2. On a port
  3. For a request
  4. Through a Transport Protocol
  5. Returns a Response
  6. Containing the requesting Resource

What does it mean for a web server to Listen?

To listen means to prepare the the web server to accept client connection requests. When an application runs on a device, it has a unique port number attached to the process running.

For example, an HTTP server would listen on port 80 while an HTTPS listens on port 443. This means the server has created listening sockets on port 80 and 443 respectively.

While a web server is waiting for new connections, the kernel puts the process into an interruptible sleep state and runs other processes. This process of entering into 'deep sleep' is important because having the process poll continuously would waste CPU resources.

How does the OS manage the web server?

The kernel is able to use the system resources more efficiently by blocking the process until there is work for it to do.

  • As soon as the network receives new data, the network card issues an interrupt(break sleep).

  • Seeing that there is an interrupt from the network card, the kernel, via the network card driver, reads the new data from the network card and stores it in memory. (This must be done quickly and is generally handled inside the interrupt handler.)

  • The kernel processes the newly arrived data and associates it with a socket. A process that is blocking on that socket will be marked runnable, meaning that it is now eligible to run. It does not necessarily run immediately (the kernel may decide to run other processes still).
  • At its leisure, the kernel will wake up the blocked web server process. (Since it is now runnable.) The web server process continues executing as if no time has passed. Its blocking system call returns and it processes any new data.

webserver.jpeg fastwebhost.in/blog/what-is-web-server-and-..

Definition

Now, how do we define web servers? A web server is software and hardware that uses HTTP (Hypertext Transfer Protocol) and other protocols to respond to client requests made over the World Wide Web.

Protocols web servers support

The familiar Hypertext Transfer Protocol (HTTP) is most often associated with the World Wide Web. This is one of the transfer protocols in use on the internet. Others include: File Transfer Protocol (FTP) and Simple Mail Transfer Protocol (SMTP). HTTP is the most used transport protocol for web services, and it plays a crucial role in REST.

Uses of web servers

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

  • sending and receiving emails;
  • downloading requests for File Transfer Protocol (FTP) files; and
  • building and publishing webpages.

Common and top web server software on the market

There are a number of common web servers available, some including:

  • Apache HTTP Server. Developed by Apache Software Foundation, it is a free and open source web server for Windows, Mac OS X, Unix, Linux, Solaris and other operating systems; it needs the Apache license.
  • Microsoft Internet Information Services (IIS). Developed by Microsoft for Microsoft platforms; it is not open sourced, but widely used.
  • Nginx. A popular open source web server for administrators because of its light resource utilization and scalability. It can handle many concurrent sessions due to its event-driven architecture. Nginx also can be used as a proxy server and load balancer.

How to secure a web server

There are a couple of security practices that can make for a safer experience

  • Using reverse proxy: this is designed to hide an internal server and act as an intermediary for traffic on an internal server;
  • Restricting access by connecting through the use of Secure Socket Shell (SSH)
  • Using a firewall and SSL : firewalls can monitor HTTP traffic while having a Secure Sockets Layer (SSL) can help keep data secure.

Thank you for coming by. Do well to reach out on LinkedIn or Twitter for collaborations ๐Ÿ˜ƒ

References

cover: kissclipart.com/shared-hosting-clipart-shar..

howtogeek.com/201958/how-do-web-servers-lis..

microfocus.com/documentation/extend-acucobo..

techtarget.com/whatis/definition/Web-server

ย