A web server is a program that accepts HTTP requests from browsers and sends back web pages and site files in response. In everyday use, the term also refers to the computer running that program. Whenever you open any website, it's the web server that locates the requested data and sends it to your browser. In this article, we'll look at how this works, what types of web servers exist, and what you need to run one yourself.
Web server: definition and two meanings of the term
The term "web server" is used in two senses, and usually the context makes it clear which one is meant. Beginners often get confused here, so let's separate the two concepts right away.
Meaning | Definition | Example |
Software | A program that listens on network ports, accepts HTTP requests, and sends back responses: pages, images, files. | Nginx, Apache |
Hardware | A computer (physical or virtual) that runs this software and stores the site's files. | VPS, cloud server |
Both parts are needed for a website to work: without a machine, the program has nowhere to run, and without the program, the machine can't serve pages over HTTP. Sometimes people say "HTTP server" or "web host" instead of "web server" — the meaning is the same. The dual meaning is a matter of history. When websites first appeared, the software and the machine were usually inseparable: one computer ran one piece of software, and that computer was called the web server.
Today a single machine can run dozens of sites, and a single site can be served by several machines at once, so it's important to distinguish software from hardware. When someone tells you "the web server is down," it's worth clarifying exactly what stopped working: the software itself, the operating system, or the physical machine.
How a web server works: the journey from browser to page
For the user, opening a website takes a fraction of a second, but under the hood there's a chain of several steps.
Address. You type in a website address or follow a link. The browser knows the domain name but doesn't know which server the site lives on.
DNS. The browser queries the DNS system and gets the IP address of the server matching that domain. You can read more about how this works in our article on DNS records.
Connection. The browser connects to that IP address. Plain HTTP uses port 80, while secure HTTPS uses port 443. With HTTPS, the two sides first negotiate encryption using an.
HTTP request. The browser sends a request: a method (most often GET), the path to the desired page, and service headers.
Processing. The web server parses the request. If a ready-made file is needed, it reads it from disk. If the page needs to be generated, for example from a database, it passes the request to an application.
HTTP response. The server returns a status code and the content. The browser receives the HTML, loads the styles, scripts, and images, and displays the page.
The status code indicates how the request was handled. Three codes come up most often:
200 — the request was successful, and the page was served.
404 — no page was found at this address.
500 — an internal server error, for example a bug in the application code.
There are others too: for instance, 301 means a permanent redirect to another address.
How HTTPS differs from HTTP
It's the same protocol, but with HTTPS the entire exchange between browser and server is encrypted. For this, an SSL/TLS certificate must be installed on the server, and the browser checks that the certificate was issued for the correct domain and hasn't expired. Without this, the browser shows a warning, and many visitors leave the site.
What happens on repeat visits
The browser stores some files in its cache, and on the next visit it may not request them again but instead ask the server whether they've changed. If not, the server simply replies that the file is unchanged, and the page loads faster. These rules are also set by the web server through special headers.

What a web server is used for: core tasks
Serving pages is just the most visible part of the job. A modern web server performs several tasks at once:
Serving static files. HTML pages, CSS, JavaScript, images, and fonts are sent to the client without extra processing.
Passing dynamic requests to an application. If a page needs to be built on the fly, the web server passes the request to PHP-FPM or another application and returns the result.
Supporting HTTPS. The server encrypts the connection using a certificate so that data can't be intercepted along the way.
Logging. Request and error logs help track down issues and analyze load.
Restricting access. Part of a site can be locked down by IP address or password. One simple method is described in our article on Auth Basic in Nginx.
Reverse proxying and load balancing. The server accepts requests and distributes them across multiple applications or machines.
Compression and caching. The server can compress text files before sending them and tell the browser how long to keep them cached. This way the site transfers less data.
Redirects and URL rules. For example, redirecting from http to https or from one page address to another.
Not every site needs all of these features. A small brochure site gets by with serving files and HTTPS, while a large project with multiple applications uses reverse proxying, load balancing, and fine-grained access rules.
Static and dynamic content
To understand the role a web server plays, it's useful to distinguish between two types of content.
Criterion | Static | Dynamic |
How it's created | A ready-made file sits on disk | Generated at request time |
Who processes it | The web server itself | An application (PHP, Python, Node.js) and a database |
Examples | Images, CSS, JavaScript, a plain HTML page | A blog post, a shopping cart, an account dashboard |
Load | Generally low | Higher, depends on the code and database queries |
A WordPress example. A visitor opens a blog post. The web server sees there's no ready-made file at that address and passes the request to PHP-FPM. PHP runs WordPress, which pulls the post's text from a MySQL or MariaDB database and assembles the HTML page. The web server then delivers the finished result to the browser. Images, styles, and scripts on the same page are sent by the web server directly, without involving PHP.
This is why the load on dynamic sites is often reduced through caching. If a page looks the same for every visitor, the generated HTML can be saved and served as a static file, without running PHP and the database on every request. On WordPress, this is handled by caching plugins or built-in web server features, and the choice of solution depends on the project.
Popular web servers: Nginx, Apache, and others
The pool of options is small, but each one has its own specialty.
Web server | Architecture | Typical use cases | .htaccess file |
Nginx | Event-driven: a single process handles many connections | Serving static content, reverse proxying, load balancing | Not supported, settings live only in the server configuration |
Apache | Modular: runs via processes or threads depending on the chosen module | The classic LAMP stack, hosting where directory-level settings are needed | Supported |
LiteSpeed | Event-driven, a commercial product (an open-source version, OpenLiteSpeed, is also available) | Hosting WordPress sites and other PHP projects | Compatible with most Apache rules |
Caddy | Written in Go, automatically obtains and renews HTTPS certificates | Small projects, simple reverse proxying | Not used, configuration lives in a Caddyfile |
There's no universal "best" web server: the choice depends on the task, the stack, and the team's habits. They're often combined: Nginx accepts connections and serves static content, while Apache or an application handles the dynamic parts. We cover installation and setup separately in our article on Nginx.
Apache has long been popular on hosting platforms largely because of its flexibility: the .htaccess file lets you change rules for a specific directory without access to the main configuration. Nginx came later and was designed from the start to handle a large number of simultaneous connections, which is why it's often placed in front of an application as a reverse proxy. LiteSpeed and Caddy are less common, but each has its own strengths: the former is geared toward hosting PHP projects, while the latter simplifies working with HTTPS.
Web server, hosting, application server, and database: what's the difference
These concepts are often mixed up, even though they describe different parts of the same system.
Term | What it is | Example |
Web server | A program that accepts HTTP requests and sends back responses | Nginx, Apache |
Hosting | A service: space and resources on a provider's servers, usually with an environment already configured | Shared hosting, VPS |
Application server | A program that runs application code and generates the dynamic response | PHP-FPM, Gunicorn, Node.js |
Database | Storage for the site's data: posts, users, orders | MySQL, MariaDB, PostgreSQL |
The simplest way to think about it: hosting provides the environment, and inside it the web server, the application, and the database all run. On shared hosting, all of this is already configured by the provider, and you only deal with your own site. On a VPS, you get a bare system and build the environment yourself.
The application server deserves a separate mention. In simple cases, its role is played by the web server itself, for example when a site consists only of static files. But for WordPress, online stores, and any project with business logic, you need a program that executes code. In this setup, the web server remains the "front door": it accepts the request, decides who should handle it, and returns the response.
Where to get a web server: shared hosting, VPS, or your own hardware
Shared hosting. The web server is already installed and configured by the provider. You upload your site and manage it through a control panel. This is the simplest option for getting started, but the server settings themselves are limited.
VPS. You get a virtual server with full access and choose and configure the web server, software versions, and rules yourself. This works well when you need control over the environment and are prepared to manage it. If you'd rather get a ready-made environment quickly, check out the application marketplace: there you can deploy, for example, WordPress without manual setup. Configuration options are listed on the VPS pricing page.
Your own hardware. An ordinary computer at home or in the office can also serve as a web server. But you'll need a static IP address, uninterrupted power and internet, constant software updates, and attention to security. Some home ISPs restrict incoming connections, so it's worth checking the terms in advance.
How to choose. If you're launching your first site and don't want to deal with server administration, start with shared hosting. If you need nonstandard software, custom web server rules, or several projects with different requirements, it makes more sense to move to a VPS. A home server is usually fine for learning and experiments, but not for sites that need to run around the clock.
Conclusion
A web server accepts HTTP requests and returns pages and site files in response, passing dynamic content on to an application. The most common options are Nginx and Apache, and there's no universal best choice between them. If you need a ready-made site without extra configuration, shared hosting is a good fit. If you need full control over the environment, take a look at VPS: you can compare plans on the Leneex VPS pricing page.
FAQ
Are a web server and a server the same thing?
No. A server is any machine that responds to requests over a network, while a web server is a program that specifically responds to requests over HTTP and HTTPS. A single machine can run a web server, a mail server, and a database all at once.
Which web server is the most popular?
Nginx and Apache usually lead the statistics, but the exact share shifts over time. For up-to-date figures, it's best to check primary sources such as W3Techs or Netcraft, noting the month and year of the data.
Do you need a web server to run a website?
Yes, without one a site can't be opened over HTTP. But on shared hosting it's already installed by the provider, so you won't need to set it up yourself.
What's the difference between a web server and hosting?
A web server is the program that serves pages. Hosting is a service that provides space and resources for your site, and the web server is just one part of that environment.
Can an ordinary computer be turned into a web server?
Yes: it's enough to install web server software and open access from the internet. But for it to run reliably, you'll need a static IP, stable power and connectivity, and protection against intrusions. For most sites, it's simpler to rent a VPS or hosting plan.







