A web server or network server is the server responsible for broadcasting a website on the Internet and is a computer that runs websites. File servers, database servers, mail servers, and web servers use different kinds of server software. Each of these applications can access files stored on a physical server and use them for various purposes. The job of a web server is to serve websites on the internet. To achieve that goal, it acts as a middleman between the server and client machines. It pulls content from the server on each user request and delivers it to the web. Web server is a server that offers to host or “hosting” over IP (Internet Protocol). Hosting is the lease of space required to publish Web pages on the Internet. In other words, hosting is keeping the pages, images, or documents on a website on a computer that can be accessed by internet users. The basic objective of the web server is to store, process, and deliver web pages to the users. This intercommunication is done using Hypertext Transfer Protocol (HTTP). These web pages are mostly static content that includes HTML documents, images, style sheets, tests, etc. Apart from HTTP, a web server also supports SMTP (Simple Mail Transfer Protocol) and FTP (File Transfer Protocol) protocol for emailing and for file transfer and storage.
The main job of a web server is to display the website content. If a web server is not exposed to the public and is used internally, then it is called an Intranet Server. When anyone requests a website by adding the URL or web address on a web browser’s (like Chrome or Firefox) address bar (like www.medium.com) the browser sends a request to the Internet for viewing the corresponding web page for that address. A Domain Name Server (DNS) converts this URL to an IP Address (For example 192.168.266.361), which in turn points to a Web Server.
HTTP stands for Hypertext Transfer Protocol. When you enter Http:// in your address bar in front of the domain, it tells the browser to connect over HTTP. HTTP uses TCP (Transmission Control Protocol), generally over port 80, to send and receive data packets over the web. To put it simply it is a protocol that’s used by a client and server which allows you to communicate with other websites. The client sends a request message to an HTTP server (after the TCP handshake) which hosts a website, the server then replies with the response message. The response message contains completion status information, such as HTTP 1.1.200 OK.
HTTPS stands for Hypertext Transfer Protocol Secure (also referred to as HTTP over TLS or HTTP over SSL). When you enter https:// in your address bar in front of the domain, it tells the browser to connect over HTTPS. Generally, sites running over HTTPS will have a redirect in place so even if you type in Http:// it will redirect to deliver over a secured connection. HTTPS also uses TCP (Transmission Control Protocol) to send and receive data packets, but it does so over port 443, within a connection encrypted by Transport Layer Security (TLS).
Although we call Apache a web server, it is not a physical server, but rather a software that runs on a server. Its job is to establish a connection between a server and the browsers of website visitors (Firefox, Google Chrome, Safari, etc.) while delivering files back and forth between them (client-server structure). Apache is a cross-platform software, therefore it works on both Unix and Windows servers.
Nginx vs Apache
Nginx pronounced Engine-X, is a newer web server application first released in 2004. As of today, it has gained quite a popularity among website owners. Nginx was created to solve the so-called c10kproblem meaning that a web server that uses threads to handle user requests is unable to manage more than 10,000 connections at the same time.
- Since Apache uses the thread-based structure, owners of traffic-heavy websites may encounter performance problems. Nginx is one of the web servers that address the c10k problem and probably the most successful one.
- Nginx has an event-driven architecture that doesn’t create a new process for each request. Instead, it handles every incoming request in a single thread. This master process manages several worker processes that perform the actual processing of requests. The event-based model of Nginx distributes user requests among worker processes in an efficient way, therefore leading to much better scalability.
Apache Tomcat, Lighttpd, Cern, Roxen are other web servers.