What is a web server?#
A web server is a program, not a device. It runs on a server and listens for HTTP and HTTPS requests. When a browser asks for an address, the web server decides which file to hand back or which site code to run.
Example#
Suppose someone opens a WordPress article page:
- The web server receives the request.
- If it is a plain file, such as an image or CSS, it sends it directly.
- If the page is generated by PHP, it hands the job to PHP.
- It returns the resulting HTML to the browser along with a status code.
The best-known ones#
- Apache: long-established, flexible, and popular on shared hosting thanks to the .htaccess file
- Nginx: lightweight and fast at handling many simultaneous connections
- LiteSpeed: an Apache-compatible web server often seen on WordPress hosting
Where you run into it#
- Errors such as 404 and 500 are returned by the web server.
- Redirects, compression and SSL certificates are usually configured in the web server.
- Hosting support may ask whether your site runs on Apache or Nginx.
Difference from a server#
A server is the machine; a web server is the software on it that serves the site.