Beginner Fundamentals

Introduction to Nginx

Nginx (pronounced “engine-x”) is a high-performance web server. It also works as a reverse proxy, load balancer, and cache. It was built to handle many simultaneous connections with low memory usage.

What Nginx Does

A web server receives HTTP requests and returns responses. Nginx can serve static files directly from disk, or forward requests to another application (a proxy).

Common roles:

  • Web server for static content (HTML, CSS, images)
  • Reverse proxy in front of app servers
  • Load balancer across multiple backends
  • TLS/HTTPS termination

Event-Driven Architecture

Older servers create one thread or process per connection. That gets expensive under load. Nginx uses an asynchronous, event-driven model: a small number of worker processes handle thousands of connections each using an event loop.

This is why Nginx stays fast and light even with high traffic.

A First Look at Config

Nginx behavior is controlled by a text configuration file. A minimal server looks like this:

server {
    listen 80;
    server_name example.com;
    root /var/www/html;
}

This listens on port 80 and serves files from /var/www/html. The next lessons explain each piece.