A web server is a computer that stores websites and serves them to users who request them. In order to view a website, you need to connect to the server that houses it and request the page you want to see. This guide will teach beginner developers what a web server is and what it does.
A web server is a computer that stores websites and serves them to users who request them. Servers are an essential part of the web, handling everything from serving up pages to running server-side applications. In this guide, we'll introduce you to what servers are and what they do so that you can understand their purpose in web development.
By the end of this primer, you should have a better understanding of what web servers are and what role they play in web development.
So, what is a web server?
What is a web server?
In essence, it's a computer that stores websites and makes them available to users all over the world. When you type in a website address - like "www.google.com" - your computer sends a request to a web server, which then sends back the website's content. Your browser then displays the content sent by the server.
Without web servers, we wouldn't be able to access the internet as we know it. Of course, there's a bit more to it than that. Let's take a closer look at how web servers work.
When you type a URL into your web browser, the browser contacts the server and requests the page. The server then sends the page back to the browser, which displays it on your screen. In order for this process to work, web servers must have two key components:
- A way to store web pages (usually in the form of files)
- A way to deliver those stored pages to browsers upon request (usually via a network protocol like Hypertext Transfer Protocol, or TCP/IP)
Most web servers also have additional features and functionality, such as the ability to run server-side scripts (like PHP or Ruby on Rails) and support for server-side applications (like databases). However, at their core, all web servers serve pages to browsers upon request.
There are many different types of web servers available, each with its own set of features and capabilities. Some of the most popular web server software includes Apache, NGINX, Microsoft IIS, and Google Web Server.
When choosing a web server for your project, it's important to consider your needs and what features are most important to you. For example, if you're planning on running server-side scripts or applications, you'll need a web server that supports those technologies.
Where are all these servers located?
Web servers can be hosted on-premises or off-premises. Hosting on-premises means that the web server is physically located in the same building as the rest of your development team. This can be advantageous because it gives you more control over the server and its security. However, it also requires more resources to maintain and keep running smoothly.
Off-premises hosting, on the other hand, means that the web server is located outside of your development team's building. This can be advantageous because it frees up resources that would otherwise be devoted to maintaining the server. However, it also means that you have less control over the server and its security.
No matter where you choose to host your web server, it's important to make sure that it's properly configured to serve your web pages quickly and efficiently. In the next section, we'll take a look at some of the things you need to consider when configuring your web server.
How do web servers work?
Now that we've answered the question "what is a web server," let's take a closer look at how they work.
As we mentioned earlier, when you type a URL into your browser, the browser contacts the server and requests the page. The server then sends the page back to the browser, which displays it on your screen.
To understand how web servers work, it's helpful to think of them as two separate components: the web server software (like Apache or NGINX) and the computer on which the software is running.
The web server software is what actually handles requests from browsers and delivers pages back to them. The computer itself just provides a place for the software to run.
Most web server software is designed to run on Unix- or Linux-based systems, although there are some options available for Windows as well. Once the web server software is installed on a computer, it can start handling requests from browsers.
Mastering Ubuntu Server
Your one-stop resource to learn, configure and use Ubuntu 22.04. Get acquainted with Ubuntu 22.04's new features. Learn how to install, manage, and troubleshoot your Ubuntu server. Leverage the improved performance and security-related aspects of Ubuntu Server 22.04
When a browser contacts the server, it does so using a network protocol like Hypertext Transfer Protocol (or HTTP, which runs on TCP/IP). The server then processes the request and sends the page back to the browser, again using TCP/IP.
The entire process happens very quickly, usually in just a few milliseconds. However, if the server is busy or there is a lot of traffic, it can take longer for the page to load.
Requests and Responses
Web server software is what actually handles requests from browsers and delivers pages back to them. The computer itself just provides a place for the software to run. Most web server software is designed to run on Unix- or Linux-based systems, although there are some options available for Windows as well. Once the web server software is installed on a computer, it can start handling requests from browsers.
The browser and the server communicate using what are known as request and response messages. The browser sends a request message to the server, and the server sends back a response message.
The request message contains information about what the browser wants, and the response message contains information about what the server is sending back.
For example, when you type a URL into your browser, the browser sends a request to the server for that page. The server then looks up the page and sends it back to the browser in the form of a response.
The request and response messages are sent using the Hypertext Transfer Protocol (or TCP/IP), which is the underlying protocol that defines how data is sent across the internet.
What is DNS?
Before a browser can contact a web server and request a page, it needs to know the server's address. The most common way to do this is via Domain Name System, or DNS.
DNS is a global network of servers that translates domain names (like example.com) into IP addresses (like 192.168.0.100). When you type a URL into your browser, the browser contacts a DNS server and requests the IP address for that domain. The DNS server then responds with the IP address, and the browser can contact the web server using that address.
Most DNS servers are provided by Internet service providers (ISPs), but there are also public DNS servers available, such as Google Public DNS and Cloudflare DNS.
What is HTTP and TCP/IP?
Hypertext Transfer Protocol (or HTTP) is the network protocol that browsers use to contact web servers and request pages. When you type a URL into your browser, the browser contacts the server using the Hypertext Transfer Protocol.
The server then processes the request and sends the page back to the browser, again using Hypertext Transfer Protocol. The entire process happens very quickly, usually in just a few milliseconds. However, if the server is busy or there is a lot of traffic, it can take longer for the page to load.
TCP/IP is the underlying protocol that defines how data is sent across the internet. Hypertext Transfer Protocol (or TCP/IP) is built on top of TCP/IP and handles the specific details of how web pages are requested and delivered.
TCP/IP is a reliable protocol, which means that it has error-checking mechanisms built in. This ensures that the data sent from the browser to the server arrives intact and vice versa.
In addition to TCP/IP, there are also other protocols that can be used to request and deliver web pages. However, TCP/IP is by far the most common.
Expert Linux Administration Guide
- Designed for absolute beginners and early Linux users with the most up-to-date knowledge.
- Contains troubleshooting tips and best practices for running a Linux system on your own.
- Supplemental knowledge and insights in server security, threat management, and virtualization.
Web server features
Now that you know what web servers are and how they work, let's take a look at some of the key features of popular web server software.
As we mentioned earlier, web servers can have many different features and capabilities. Some of the most common features include:
- The ability to run server-side scripts (like PHP or Ruby on Rails)
- Support for server-side applications (like databases)
- Security features (like SSL/TLS support)
- Virtual hosting (which allows a single server to host multiple websites)
Not all web servers have all of these features, and the features that are available can vary from one server to another. When choosing a web server for your project, it's important to consider your needs and what features are most important to you.
For example, if you're planning on running server-side scripts or applications, you'll need a web server that supports those technologies. Or, if you're concerned about security, you'll want to choose a server with features like SSL/TLS support.
In the next section, we'll take a closer look at some of the most popular web server software options.
Popular web server software
There are many different types of web server software available, each with its own set of features and capabilities. Some of the most popular web server software includes Apache, NGINX, Microsoft IIS, and Google Web Server.
When choosing a web server for your project, it's important to consider your needs and what features are most important to you. For example, if you're planning on running server-side scripts or applications, you'll need a web server that supports those technologies.
What are the different types of web server?
Now that you know what a web server is and what it does, you're ready to start choosing the right server for your project.
The two most common types of web servers are Apache and NGINX. Both are open-source software, which means they're free to use.
- Apache is the most popular web server software, and it's used by some of the largest websites in the world, including Facebook and Amazon. It's known for being very versatile and easy to use.
- NGINX is a newer option that's become increasingly popular in recent years. It's known for being very fast and efficient, especially when handling large amounts of traffic.
There are also some proprietary web server options, like Microsoft IIS. These servers are not open-source, which means they're not free to use.
In most cases, you'll want to reach for Apache or NGINX. However, if you have specific needs or requirements, another option may be a better fit for your project.
The best web server software options
There are many different types of web server software available, each with its own set of features and capabilities.
When choosing a web server for your project, it's important to consider your needs and what features are most important to you. For example, if you're planning on running server-side scripts or applications, you'll need a web server that supports those technologies.
NGINX
NGINX is a free, open-source, high-performance web server and reverse proxy. NGINX can be used for all types of websites and applications, including e-commerce, streaming media, and large scale websites.
nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev. According to Netcraft, nginx served or proxied 21.21% busiest sites in November 2022.
A newer option that's become increasingly popular in recent years, NGINX is known for being very fast and efficient, especially when handling large amounts of traffic.
Some of the key features of NGINX include:
- Fast and efficient: Well-known for being fast and efficient, especially when handling high traffic loads.
- Wide protocol support: NGINX supports multiple protocols, including TCP, UDP, and SSL/TLS.
- Cross-platform support: NGINX is available on a variety of platforms, including Windows, Mac OS X, and Linux.
- Modular design: NGINX's modular design makes it easy to extend and customize. NGINX can be used as a web server, reverse proxy, load balancer, or mail proxy. It's also highly configurable, so you can tailor it to your needs.
- Scaling: NGINX's load balancer functionality helps distribute traffic across multiple servers.
- Secure: NGINX comes with a number of security features, including SSL/TLS support and password protection.
If you're looking for a fast and efficient web server, NGINX is a great option. It's also very flexible, so it can be used for a variety of applications. And because it's free and open-source, NGINX is a good choice for those who want a choice with longevity, one that offers complete control, and one that lowers costs.
Nginx HTTP Server: Harness the Power of Nginx
Make the most of your infrastructure and serve pages faster than ever with Nginx.
- Discover possible interactions between Nginx and Apache to get the best of both worlds
- Learn to exploit the features offered by Nginx for your web applications
- Get your hands on the most updated version of Nginx (1.13.2) to support all your web administration requirements
Apache httpd
Formerly the most popular web server software, Apache is known for being very versatile and easy to use. It's used by some of the largest websites in the world, including Facebook and Amazon.
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
Some of the key features of Apache httpd include:
- Modular design: Apache httpd is designed as a modular server, which means that it can be easily customized and extended to meet your needs.
- Support for multiple languages: Apache httpd supports a variety of programming languages, including PHP, Perl, Python, and Ruby.
- HTTP/2 support: Apache httpd now supports HTTP/2, the latest version of the HTTP protocol. This provides a number of performance enhancements, including faster page loading times.
- SSL/TLS support: Apache httpd supports SSL/TLS encryption, which helps keep your data safe and secure.
- Cross-platform support: Apache httpd is available on a variety of platforms, including Windows, Mac OS X, and Linux.
There are a few reasons Apache is the most popular web server. First, it's very versatile and can be used for a wide range of applications. It's also easy to use, which makes it a good option for those who are new to web development. Finally, the software is free and open-source, making it a great option for those on a budget and for those who want full control over their server.
Apache: The Definitive Guide, 3rd Edition
With this new third edition of Apache: The Definitive Guide, web administrators new to Apache will come up to speed quickly, and experienced administrators will find the logically organized, concise reference sections indispensable, and system programmers interested in customizing their servers will rely on the chapters on the API and Apache modules.
Microsoft IIS
Internet Information Services (IIS) is a web server software package designed for use with Microsoft Windows. It is used to host websites and other content on the web. IIS is a component of the Windows Server operating system.
A proprietary web server option from Microsoft, IIS is not open-source but does offer a wide range of features.
Internet Information Services (IIS) for Windows® Server is a flexible, secure and manageable Web server for hosting anything on the Web. From media streaming to web applications, IIS's scalable and open architecture is ready to handle the most demanding tasks.
IIS offers a number of features, including:
- Media streaming: IIS can stream audio and video content using a variety of protocols, including RTSP, MMS, and HLS.
- Web applications: IIS can host ASP.NET web applications and WCF services.
- Load balancing: IIS can distribute traffic across multiple servers using a number of methods, including Round Robin and Least Connections.
- Security: IIS supports SSL/TLS encryption and can be configured to use a variety of authentication methods, including Windows Authentication and Forms-based Authentication.
IIS is a good choice for those who need a feature-rich web server option. It's also a good choice for those who are looking for tight integration with other Microsoft products, as IIS is designed to work well with other Microsoft technologies.
A proprietary web server option from Microsoft, IIS is not open-source. However, it is widely used and provides a number of features and capabilities.
IIS 10: Essentials for Administration
A hands-on, personalized guide to IIS, covering all release versions from 10 to 7 for all current Windows and Windows Server operating systems.
LiteSpeed Web Server
LiteSpeed Web Server (LSWS) is a commercial web server. It's known for being very fast and lightweight, and it includes a number of features to improve security, performance, and scalability.
It's built on top of LiteSpeed's OpenLiteSpeed, an open-source edition.
Some of the key features of LiteSpeed Web Server include:
- Fast and lightweight: It's known for being very fast and it includes features to improve security, performance, and scalability.
- Event-driven architecture: Event-driven architecture is based on the idea of reacting to events as they happen, rather than waiting for a request. The benefits include improved scalability, performance, and responsiveness.
- Built for speed and security: Features Anti-DDoS connection and bandwidth throttling, ModSecurity v3 integration, and more.
- Intelligent cache acceleration & PageSpeed optimization: The built-in cache module is highly-customizable and efficient for an exceptional user experience. Automatically implement Google’s PageSpeed optimization system with the mod_pagespeed module.
- PHP LiteSpeed SAPI: LiteSpeed includes the native PHP SAPI, which allows external applications written in PHP to run up to 50% faster.
- WordPress acceleration: LSCache is a LiteSpeed-specific caching engine that can greatly improve the performance of WordPress sites.
LiteSpeed is a good choice for those who need a high-performance server. It's also a good choice for those who are looking for an open-source server option.
How to choose web server software: What to look for in a web server
Now that you know what a web server is and what some of the most popular options are, you might be wondering how to choose the right one for your project.
When choosing a web server, there are a few key features to look for:
- Support for the technologies you need: If you're planning on running server-side scripts or applications, make sure the web server you choose supports those technologies.
- Ease of use: Choose a server that's easy to set up and use, especially if you're new to web development.
- Performance: Make sure the server can handle the amount of traffic you're expecting.
- Pricing: If you're on a budget, look for a free or open-source option.
Now that you know what a web server is and what some of the most popular options are, you might be wondering how to choose the right one for your project.
The first step is to identify your needs. What features are most important to you? Do you need support for server-side scripting or applications? Are you concerned about security? Once you know what you need, you can start narrow down your options.
From there, you can start looking at things like ease of use and performance. Choose a web server that's easy to set up and use, especially if you're new to web development. Make sure the server can handle the amount of traffic you're expecting.
Finally, consider pricing. If you're on a budget, look for a free or open-source option.
There are many different types of web server software available, each with its own set of features and capabilities. It's important to consider your needs and what features are most important to you when choosing a web server for your project.
For example, if you're planning on running server-side scripts or applications, you'll need a web server that supports those technologies. If security is a concern, look for a server with built-in security features. And if you're on a budget, there are plenty of free and open-source options available.
Take some time to research your options and choose the web server that's right for you. With so many different options available, you're sure to find one that meets your needs.
Configuring your web server
When configuring your web server, there are a few things you need to keep in mind:
- The server software you're using
- The operating system the server is running on
- The hardware the server is running on
The most popular web server software is Apache, which is an open source project. Other popular options include Microsoft IIS and Nginx. All of these options are available for both Windows and Linux servers.
Before you start configuring your server, you need to decide what software you're going to use. Once you've chosen a web server, you can download it and install it on your server.
Next, you need to configure the web server itself. This includes setting up things like virtual hosts and security settings. The exact steps will vary depending on the software you're using, but there are plenty of resources available to help you get started.
You can find some introductory resources on Apache configuration here:
And some starting points for NGINX include:
Finally, you need to configure your operating system and hardware. This includes things like setting up firewalls and configuring DNS settings. Again, the exact steps will vary depending on what you're using, but there are plenty of resources available to help you get started.
Once you've finished configuring your web server, you're ready to start serving content to your users. Congratulations! You've just set up your first web server.
Conclusion: An introduction to web servers for beginner developers
Now that you know what web servers are and what they do, you're well on your way to becoming a web development pro. Be sure to choose the right server for your project, and don't forget to check out our other blog posts for more great tips and tricks.
Keep in mind that this is just a basic guide. There's a lot more to learn about web servers and how they work. But with this guide, you should have a good foundation to get started.
If you're interested in learning more, check out our Learn to Code guide and our other articles on web development.