ποΈ Introduction
Welcome to the Nginx handbook.
ποΈ Basics
NGINX (pronounced βengine-xβ) is a high-performance web server, reverse proxy, load balancer, and HTTP cache.
ποΈ NGINX vs Apache
Both NGINX and Apache HTTP Server are the most popular web servers used to deliver websites and web applications to users.
ποΈ Installation
Installation on Ubuntu
ποΈ Configuration
NGINX uses a centralized, hierarchical configuration system.
ποΈ Contexts
NGINX configuration is hierarchical.
ποΈ Directives vs Blocks
NGINX configuration is built from directives. Some directives are simple (single-line), while others are block directives that contain nested directives.
ποΈ Include Directive
The include directive tells NGINX to read and insert configuration files from another location as if their contents were written directly at that place.
ποΈ Reverse Proxy
2 items
ποΈ Load Balancing
When NGINX acts as a reverse proxy, it can distribute incoming requests across multiple backend servers to achieve:
ποΈ Health Checks
Health checks allow NGINX to determine whether a backend server is healthy or unhealthy and decide whether to send traffic to it.
ποΈ Static Files
Static files are files that are sent as-is to the client, without backend processing.
ποΈ MIME Types
MIME (Multipurpose Internet Mail Extensions) types tell the client (browser) what kind of content is being sent, so the client knows how to handle or render it.
ποΈ Default Server Block
The default server block is the server context NGINX uses when an incoming HTTP request does not match any server_name on the requested IP:port.
ποΈ Index Files
An index file is the default file that NGINX serves when a client requests a directory URI (i.e., a URL ending with /) without specifying a filename.
ποΈ Auto Index
The autoindex directive enables NGINX to automatically generate a directory listing when a client requests a directory URL that does not contain an index file.
ποΈ SSL_TLS setup
SSL (Secure Sockets Layer) and its successor TLS (Transport Layer Security) are cryptographic protocols that:
ποΈ HTTP to HTTPS
HTTP β HTTPS redirection forces all users who access your site over unencrypted HTTP (port 80) to be automatically redirected to encrypted HTTPS (port 443).
ποΈ Rate Limiting
Rate limiting restricts how many requests a client can make to your server within a defined time window.
ποΈ Connection Limiting
Connection limiting restricts the number of simultaneous (concurrent) connections a client can open to your NGINX server.
ποΈ Restricting Access
Restricting access means controlling who can access your application, what they can access, and from where.
ποΈ Basic Authentication
HTTP Basic Authentication is a simple authentication mechanism where:
ποΈ Logging
5 items
ποΈ Name Based Virtual Hosting
Name-based virtual hosting allows multiple websites (domains) to be hosted on a single IP address.
ποΈ IP Based Virtual Hosting
IP-based virtual hosting means hosting multiple websites on the same server, where each website has its own IP address.
ποΈ Default Server
The default server is the fallback virtual host that NGINX uses when an incoming request does not match any other server block for the given IP address and port.
ποΈ Prefix Match
Prefix matching means NGINX matches a request based on the beginning (prefix) of the URI.
ποΈ Exact Match
Exact matching tells NGINX:
ποΈ Regex
Regex location matching lets NGINX choose a location block using a regular expression applied to the request URI.
ποΈ Priority Rules
When a request comes in, NGINX may have multiple location blocks that could match.
ποΈ Rewrite & Redirect
What Are Rewrite & Redirect Rules?