Web Server #
This section covers Nginx in its most basic yet most powerful role: as a web server serving files directly from disk. Although it sounds simple, there are many technical details you need to master to do it correctly, securely, and efficiently — from how Nginx determines which file path to serve, how to set up multiple sites on one server, handling directory requests, to presenting professional error pages.
Nginx is essentially a highly efficient machine for answering the question: “Which file on disk should I send for this request?” Every article in this section dissects one aspect of that question.
Learning Map #
flowchart TD
A["📁 Static Files\nroot directive, sendfile,\nMIME types, cache headers"] --> B["🏠 Virtual Host\nname-based, IP-based,\nmulti-site, HTTPS"]
B --> C["🔀 Root vs Alias\nPath formation,\ntrailing slash, try_files"]
C --> D["📋 Index & Autoindex\nindex directive,\ndirectory listing, security"]
D --> E["⚠️ Error Page\nerror_page, internal redirect,\nproxy_intercept_errors"]Articles in This Section #
| Article | What You’ll Learn |
|---|---|
| Serving Static Files | How Nginx reads and sends files from disk, transfer optimization with sendfile, browser cache headers, and a complete configuration for production static sites |
| Virtual Host | Running many websites from one server — name-based hosting, per-domain SSL certificate management, and multi-site management workflows |
| Root & Alias | The fundamental difference in how root and alias construct file paths, when to use each, and the trailing slash traps that most often cause errors |
| Index & Autoindex | Default index files when a request hits a directory, when directory listing is useful and when it’s dangerous, and how to secure it |
| Custom Error Page | Replacing Nginx’s built-in error pages with custom pages, handling upstream/backend errors, and hiding server version information |