KAHIBARO Bookshelves
Discord Login Register

5.5.2. Nginx as a load balancer

Introduction

Nginx is widely known as a high performance web server and reverse proxy. One of its most powerful roles in server environments is to act as a load balancer, distributing client traffic across multiple backend servers. This chapter focuses on using Nginx specifically as a load balancer, how to configure it, and what options and strategies it offers.

Core Load Balancing Concepts in Nginx

When Nginx acts as a load balancer, it typically listens for client connections on a public interface, then proxies each request to one of several backend servers. Nginx calls these backends upstream servers. The configuration uses an upstream block to define the backend pool, and a server block with location directives to route incoming requests to that pool.

At a high level, the flow is: a client connects to Nginx, Nginx chooses a backend from the upstream group using a balancing algorithm, then forwards the HTTP request to that backend and relays the response back to the client.

Nginx supports several load balancing methods, both built in and via optional modules. These methods determine how Nginx selects which backend to use for each request.

Basic Upstream Configuration

To configure Nginx as a load balancer, you first define an upstream group. This creates a named pool of backend servers that can be reused in one or more server blocks.

A very simple configuration might look like this:

http {
    upstream backend_app {
        server 10.0.0.2:8080;
        server 10.0.0.3:8080;
        server 10.0.0.4:8080;
    }
    server {
        listen 80;
        server_name example.com;
        location / {
            proxy_pass http://backend_app;
        }
    }
}

Here the upstream group backend_app contains three application servers. The proxy_pass directive instructs Nginx to forward matching traffic to that group. By default, Nginx uses a round robin method to cycle through the servers.

Nginx upstream groups are defined inside the http context, and each server directive inside an upstream block must specify an address and port. Forgetting the port, or placing upstream inside a server block, will result in configuration errors.

Built-in Load Balancing Methods

Nginx supports several built in balancing strategies. The most important ones are round robin, least connections, and IP hash.

Round Robin

If you simply list servers in an upstream block without any special parameters, Nginx uses round robin. Each new connection is sent to the next server in the list, roughly distributing load evenly over time.

You do not need to specify any extra directives for this:

upstream backend_rr {
    server 10.0.0.2:8080;
    server 10.0.0.3:8080;
    server 10.0.0.4:8080;
}

Round robin works best when all backend servers are similar in capacity and performance, and when requests are roughly equal in cost.

Least Connections

The least_conn method sends each new connection to the server that currently has the fewest active connections. This is useful when some requests take longer than others, since it adapts to varying request durations.

You enable it by adding least_conn; inside the upstream block:

upstream backend_least_conn {
    least_conn;
    server 10.0.0.2:8080;
    server 10.0.0.3:8080;
    server 10.0.0.4:8080;
}

With least_conn Nginx tracks how many connections each server is currently handling. The next request is assigned to the server with the lowest count. This can improve utilization when workloads are uneven.

IP Hash

The ip_hash method aims to send all requests from the same client IP address to the same backend server. This is a basic form of session stickiness.

You enable it with:

upstream backend_ip_hash {
    ip_hash;
    server 10.0.0.2:8080;
    server 10.0.0.3:8080;
    server 10.0.0.4:8080;
}

Nginx uses a hash of the client IP to pick a specific backend. As long as the upstream list does not change and the client IP remains the same, the client will usually hit the same backend server.

IP hash can help when the backend application stores sessions in local memory and you cannot use a shared session store. However, it does not work well when many users share the same IP, for example behind NAT, because they will all be sent to the same backend.

Weighting and Server Parameters

Not all backend servers are equal. Some may have more CPU or memory. Nginx allows you to assign weights to servers so that more powerful nodes receive more traffic.

To control weights, you add a weight parameter to each server directive:

upstream backend_weighted {
    server 10.0.0.2:8080 weight=3;
    server 10.0.0.3:8080 weight=2;
    server 10.0.0.4:8080 weight=1;
}

With this configuration, Nginx will send roughly 3 parts of traffic to 10.0.0.2, 2 parts to 10.0.0.3, and 1 part to 10.0.0.4. In round robin mode, Nginx cycles through servers according to these weights.

You can also adjust how Nginx treats problematic or slow servers. Common parameters include max_fails, fail_timeout, and backup.

For example:

upstream backend_advanced {
    server 10.0.0.2:8080 weight=3 max_fails=2 fail_timeout=30s;
    server 10.0.0.3:8080 weight=2;
    server 10.0.0.4:8080 backup;
}

Here:

max_fails sets how many failed attempts are allowed before the server is temporarily marked as down.

fail_timeout defines the time window for counting failures and how long the server remains considered down.

backup marks a server as a backup that only receives traffic when all primary servers are unavailable.

If you do not configure timeouts and failure limits, Nginx may continue to send traffic to an unhealthy server. Always test and tune max_fails, fail_timeout, and other parameters to match your environment and health expectations.

HTTP Proxy Configuration Details

To use Nginx as an HTTP load balancer, you combine upstream definitions with proxy_pass and appropriate proxy headers. A typical configuration for proxying HTTP looks like this:

upstream backend_app {
    least_conn;
    server app1.internal:8080;
    server app2.internal:8080;
}
server {
    listen 80;
    server_name app.example.com;
    location / {
        proxy_pass         http://backend_app;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_connect_timeout   5s;
        proxy_send_timeout      30s;
        proxy_read_timeout      30s;
    }
}

In this example, Nginx passes through important client information using HTTP headers. The backend app can then log the original client IP and protocol instead of seeing only the Nginx address.

Connection and read timeouts protect clients from hanging indefinitely if a backend is slow or unresponsive. These values should be tuned to the expected performance and latency of your application.

Health Checks and Failure Handling

Nginx has built in concepts of failures based on connection errors and timeouts. If a server fails too many times according to max_fails and fail_timeout, Nginx temporarily avoids sending traffic there. This is a simple passive health checking mechanism.

A typical configuration to use passive checks might look like:

upstream backend_passive {
    server app1.internal:8080 max_fails=3 fail_timeout=10s;
    server app2.internal:8080 max_fails=3 fail_timeout=10s;
}

With this setup, if a server repeatedly fails within 10 seconds, Nginx will mark it as down for the duration of fail_timeout. If that server later responds successfully again, Nginx will bring it back into rotation automatically.

More advanced active health checks, where Nginx proactively polls servers with HTTP requests, require additional modules or Nginx Plus. In many open source deployments, passive health checks combined with monitoring tools are used instead.

Session Persistence Options

Certain applications rely on sticky sessions where subsequent requests from the same client must reach the same backend. Nginx provides several approaches for session persistence.

The simplest native method is ip_hash, as described earlier, which uses client IP address as a key. While simple, it can be inaccurate when many users share IPs or when clients switch networks.

A more flexible approach uses application layer techniques, such as sharing session data in a database or cache, which removes the need for load balancer stickiness. However, when you must enforce stickiness at Nginx level with community modules, cookie based approaches can be used, but they are outside the built in feature set and require additional components.

In situations where you do not have shared session storage and cannot change the application, ip_hash remains the primary built in option. When using it, you must understand its limitations: changes to the upstream server list can reassign users, and multi IP environments can break the mapping.

SSL Termination and Load Balancing

Nginx can terminate TLS connections from clients, then forward plain HTTP traffic to backend servers. This reduces encryption workload on the backend and simplifies certificate management. You configure Nginx to listen on port 443 with SSL parameters and still use upstream balancing behind it.

An example configuration for HTTPS termination with load balancing is:

upstream backend_secure {
    least_conn;
    server app1.internal:8080;
    server app2.internal:8080;
}
server {
    listen 443 ssl;
    server_name secure.example.com;
    ssl_certificate     /etc/nginx/ssl/secure.crt;
    ssl_certificate_key /etc/nginx/ssl/secure.key;
    location / {
        proxy_pass         http://backend_secure;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto https;
    }
}

In this setup, Nginx receives encrypted traffic, decrypts it, and forwards the request unencrypted to the backend. The X-Forwarded-Proto header allows the backend to know that the original connection from the client used HTTPS.

If you need end to end encryption, you can configure Nginx to proxy to HTTPS backends instead, by using proxy_pass https://backend_name; and configuring the upstream to use SSL.

TCP/UDP Load Balancing with Stream

Although Nginx is often used for HTTP, it can also load balance arbitrary TCP and UDP protocols through the stream context. This is useful for databases, mail protocols, or custom binary services.

A basic TCP load balancing configuration looks like:

Views: 0

Comments

Please login to add a comment.

Don't have an account? Register now!

Where to Move

Move chapter:

  • ☰ 1. PART I — Linux Fundamentals (Beginner)
    • ☰ 1.1. What Is Linux?
      • ☰ 1.1.1. What is an operating system
        • ☰ 1.1.2. History of Unix and Linux
          • ☰ 1.1.3. The Linux kernel
            • ☰ 1.1.4. GNU and the Free Software Foundation
              • ☰ 1.1.5. Open source philosophy
                • ☰ 1.1.6. Where Linux is used today
                  • ☰ 1.1.7. Desktop vs server vs embedded Linux
                  • ☰ 1.2. Choosing a Linux Distribution
                    • ☰ 1.2.1. What is a distribution?
                      • ☰ 1.2.2. Package formats (deb, rpm, pacman)
                        • ☰ 1.2.3. Popular distributions
                          • ☰ 1.2.3.1. Ubuntu
                            • ☰ 1.2.3.2. Debian
                              • ☰ 1.2.3.3. Fedora
                                • ☰ 1.2.3.4. Arch Linux
                                  • ☰ 1.2.3.5. openSUSE
                                  • ☰ 1.2.4. Rolling vs fixed release
                                    • ☰ 1.2.5. Choosing the right distribution
                                    • ☰ 1.3. Installing Linux
                                      • ☰ 1.3.1. Creating a bootable USB
                                        • ☰ 1.3.2. Installing on real hardware
                                          • ☰ 1.3.3. Dual booting with Windows
                                            • ☰ 1.3.4. Installing in a virtual machine
                                              • ☰ 1.3.5. Partitioning
                                                • ☰ 1.3.5.1. `/` (root)
                                                  • ☰ 1.3.5.2. `/home`
                                                    • ☰ 1.3.5.3. Swap
                                                    • ☰ 1.3.6. First-time setup
                                                    • ☰ 1.4. First Steps After Installation
                                                      • ☰ 1.4.1. Desktop environment basics
                                                        • ☰ 1.4.2. Updating the system
                                                          • ☰ 1.4.3. Installing essential tools
                                                            • ☰ 1.4.4. Setting up drivers
                                                              • ☰ 1.4.5. Using the software center
                                                              • ☰ 1.5. Linux Filesystem Hierarchy
                                                                • ☰ 1.5.1. Overview of the root filesystem
                                                                  • ☰ 1.5.2. Important directories
                                                                    • ☰ 1.5.2.1. `/etc`
                                                                      • ☰ 1.5.2.2. `/var`
                                                                        • ☰ 1.5.2.3. `/usr`
                                                                          • ☰ 1.5.2.4. `/tmp`
                                                                            • ☰ 1.5.2.5. `/dev`
                                                                              • ☰ 1.5.2.6. `/proc`
                                                                                • ☰ 1.5.2.7. `/sys`
                                                                                • ☰ 1.5.3. File types
                                                                                  • ☰ 1.5.4. Absolute vs relative paths
                                                                                  • ☰ 1.6. The Linux Graphical Environment
                                                                                    • ☰ 1.6.1. GNOME
                                                                                      • ☰ 1.6.2. KDE Plasma
                                                                                        • ☰ 1.6.3. XFCE
                                                                                          • ☰ 1.6.4. File managers
                                                                                            • ☰ 1.6.5. System settings
                                                                                              • ☰ 1.6.6. Workspaces and window management
                                                                                            • ☰ 2. PART II — Command Line Essentials
                                                                                              • ☰ 2.1. Terminal and Shell Basics
                                                                                                • ☰ 2.1.1. What is a shell?
                                                                                                  • ☰ 2.1.2. Bash vs Zsh vs Fish
                                                                                                    • ☰ 2.1.3. Command structure
                                                                                                      • ☰ 2.1.4. Environment variables
                                                                                                        • ☰ 2.1.5. Getting help
                                                                                                          • ☰ 2.1.6. Command history and autocomplete
                                                                                                          • ☰ 2.2. Files and Directories
                                                                                                            • ☰ 2.2.1. Listing files
                                                                                                              • ☰ 2.2.2. Navigating directories
                                                                                                                • ☰ 2.2.3. File operations
                                                                                                                  • ☰ 2.2.4. Wildcards and globbing
                                                                                                                    • ☰ 2.2.5. Searching files
                                                                                                                    • ☰ 2.3. Viewing and Editing Text Files
                                                                                                                      • ☰ 2.3.1. Viewing tools
                                                                                                                        • ☰ 2.3.2. Editing with nano
                                                                                                                          • ☰ 2.3.3. Introduction to vim
                                                                                                                            • ☰ 2.3.4. Input/output redirection
                                                                                                                            • ☰ 2.4. Users, Permissions, and Ownership
                                                                                                                              • ☰ 2.4.1. Users and groups
                                                                                                                                • ☰ 2.4.2. Permission types (r, w, x)
                                                                                                                                  • ☰ 2.4.3. Changing permissions
                                                                                                                                    • ☰ 2.4.4. Changing ownership
                                                                                                                                      • ☰ 2.4.5. Using sudo
                                                                                                                                      • ☰ 2.5. Package Management
                                                                                                                                        • ☰ 2.5.1. Software repositories
                                                                                                                                          • ☰ 2.5.2. APT (Debian/Ubuntu)
                                                                                                                                            • ☰ 2.5.3. DNF (Fedora/RHEL)
                                                                                                                                              • ☰ 2.5.4. Pacman (Arch Linux)
                                                                                                                                                • ☰ 2.5.5. Snap, Flatpak, AppImage
                                                                                                                                                  • ☰ 2.5.6. System upgrades
                                                                                                                                                  • ☰ 2.6. Working with Processes
                                                                                                                                                    • ☰ 2.6.1. What is a process?
                                                                                                                                                      • ☰ 2.6.2. Viewing processes
                                                                                                                                                        • ☰ 2.6.3. Killing processes
                                                                                                                                                          • ☰ 2.6.4. Foreground and background jobs
                                                                                                                                                            • ☰ 2.6.5. System services and daemons
                                                                                                                                                            • ☰ 2.7. Introduction to Shell Scripting
                                                                                                                                                              • ☰ 2.7.1. Writing your first script
                                                                                                                                                                • ☰ 2.7.2. Variables
                                                                                                                                                                  • ☰ 2.7.3. Conditionals
                                                                                                                                                                    • ☰ 2.7.4. Loops
                                                                                                                                                                      • ☰ 2.7.5. Functions
                                                                                                                                                                        • ☰ 2.7.6. Making scripts executable
                                                                                                                                                                      • ☰ 3. PART III — Intermediate System Administration
                                                                                                                                                                        • ☰ 3.1. Systemd and Service Management
                                                                                                                                                                          • ☰ 3.1.1. What is systemd?
                                                                                                                                                                            • ☰ 3.1.2. Managing services (systemctl)
                                                                                                                                                                              • ☰ 3.1.3. Boot targets
                                                                                                                                                                                • ☰ 3.1.4. System logs (journalctl)
                                                                                                                                                                                  • ☰ 3.1.5. Creating custom services
                                                                                                                                                                                  • ☰ 3.2. Storage and Filesystems
                                                                                                                                                                                    • ☰ 3.2.1. Devices and partitions
                                                                                                                                                                                      • ☰ 3.2.2. Filesystems (EXT4, XFS, Btrfs)
                                                                                                                                                                                        • ☰ 3.2.3. Mounting and unmounting
                                                                                                                                                                                          • ☰ 3.2.4. Disk usage tools
                                                                                                                                                                                            • ☰ 3.2.5. Archiving and compression (tar, gzip, xz)
                                                                                                                                                                                            • ☰ 3.3. Networking Fundamentals
                                                                                                                                                                                              • ☰ 3.3.1. IP addressing
                                                                                                                                                                                                • ☰ 3.3.2. Subnets and routing
                                                                                                                                                                                                  • ☰ 3.3.3. DNS and hostnames
                                                                                                                                                                                                    • ☰ 3.3.4. Networking tools (ip, ss, ping)
                                                                                                                                                                                                      • ☰ 3.3.5. Editing network configuration files
                                                                                                                                                                                                      • ☰ 3.4. User and Group Administration
                                                                                                                                                                                                        • ☰ 3.4.1. User information files
                                                                                                                                                                                                          • ☰ 3.4.2. Creating and removing users
                                                                                                                                                                                                            • ☰ 3.4.3. Password policies
                                                                                                                                                                                                              • ☰ 3.4.4. Managing groups
                                                                                                                                                                                                                • ☰ 3.4.5. Shell configuration
                                                                                                                                                                                                                • ☰ 3.5. System Monitoring
                                                                                                                                                                                                                  • ☰ 3.5.1. CPU and memory monitoring
                                                                                                                                                                                                                    • ☰ 3.5.2. Disk and I/O monitoring
                                                                                                                                                                                                                      • ☰ 3.5.3. Log files in /var/log
                                                                                                                                                                                                                        • ☰ 3.5.4. Boot performance
                                                                                                                                                                                                                          • ☰ 3.5.5. Monitoring running services
                                                                                                                                                                                                                          • ☰ 3.6. Backup and Restore
                                                                                                                                                                                                                            • ☰ 3.6.1. Backup strategies
                                                                                                                                                                                                                              • ☰ 3.6.2. Using rsync
                                                                                                                                                                                                                                • ☰ 3.6.3. Creating tar archives
                                                                                                                                                                                                                                  • ☰ 3.6.4. Using snapshot systems
                                                                                                                                                                                                                                    • ☰ 3.6.5. Automating backups
                                                                                                                                                                                                                                    • ☰ 3.7. Basic System Security
                                                                                                                                                                                                                                      • ☰ 3.7.1. Firewalls (UFW, firewalld)
                                                                                                                                                                                                                                        • ☰ 3.7.2. Authentication policies
                                                                                                                                                                                                                                          • ☰ 3.7.3. SSH security basics
                                                                                                                                                                                                                                            • ☰ 3.7.4. SELinux and AppArmor overview
                                                                                                                                                                                                                                              • ☰ 3.7.5. Intrusion detection basics
                                                                                                                                                                                                                                            • ☰ 4. PART IV — Advanced Linux Skills
                                                                                                                                                                                                                                              • ☰ 4.1. Advanced Shell Scripting
                                                                                                                                                                                                                                                • ☰ 4.1.1. Script structure
                                                                                                                                                                                                                                                  • ☰ 4.1.2. Error handling
                                                                                                                                                                                                                                                    • ☰ 4.1.3. Debugging scripts
                                                                                                                                                                                                                                                      • ☰ 4.1.4. Scheduled tasks (cron)
                                                                                                                                                                                                                                                      • ☰ 4.2. The Linux Boot Process
                                                                                                                                                                                                                                                        • ☰ 4.2.1. BIOS vs UEFI
                                                                                                                                                                                                                                                          • ☰ 4.2.2. Understanding GRUB2
                                                                                                                                                                                                                                                            • ☰ 4.2.3. Kernel loading
                                                                                                                                                                                                                                                              • ☰ 4.2.4. initramfs
                                                                                                                                                                                                                                                                • ☰ 4.2.5. Troubleshooting boot issues
                                                                                                                                                                                                                                                                • ☰ 4.3. Kernel Management
                                                                                                                                                                                                                                                                  • ☰ 4.3.1. What is the kernel?
                                                                                                                                                                                                                                                                    • ☰ 4.3.2. Kernel modules
                                                                                                                                                                                                                                                                      • ☰ 4.3.3. Kernel parameters
                                                                                                                                                                                                                                                                        • ☰ 4.3.4. Compiling a custom kernel
                                                                                                                                                                                                                                                                          • ☰ 4.3.5. Kernel versioning and updates
                                                                                                                                                                                                                                                                          • ☰ 4.4. Advanced Filesystems and Storage
                                                                                                                                                                                                                                                                            • ☰ 4.4.1. LVM concepts
                                                                                                                                                                                                                                                                              • ☰ 4.4.2. Logical volumes
                                                                                                                                                                                                                                                                                • ☰ 4.4.3. RAID levels
                                                                                                                                                                                                                                                                                  • ☰ 4.4.4. Full disk encryption (LUKS)
                                                                                                                                                                                                                                                                                    • ☰ 4.4.5. Snapshots and rollbacks
                                                                                                                                                                                                                                                                                    • ☰ 4.5. Network Services
                                                                                                                                                                                                                                                                                      • ☰ 4.5.1. SSH server configuration
                                                                                                                                                                                                                                                                                        • ☰ 4.5.2. NFS
                                                                                                                                                                                                                                                                                          • ☰ 4.5.3. Samba
                                                                                                                                                                                                                                                                                            • ☰ 4.5.4. FTP/SFTP
                                                                                                                                                                                                                                                                                              • ☰ 4.5.5. Firewalls in depth
                                                                                                                                                                                                                                                                                              • ☰ 4.6. Logging and Auditing
                                                                                                                                                                                                                                                                                                • ☰ 4.6.1. Systemd logging
                                                                                                                                                                                                                                                                                                  • ☰ 4.6.2. Traditional logs in /var/log
                                                                                                                                                                                                                                                                                                    • ☰ 4.6.3. Auditd
                                                                                                                                                                                                                                                                                                      • ☰ 4.6.4. Log rotation
                                                                                                                                                                                                                                                                                                        • ☰ 4.6.5. Creating custom logs
                                                                                                                                                                                                                                                                                                        • ☰ 4.7. Virtualization and Containers
                                                                                                                                                                                                                                                                                                          • ☰ 4.7.1. Virtual machines (KVM/QEMU)
                                                                                                                                                                                                                                                                                                            • ☰ 4.7.2. Linux containers (LXC/LXD)
                                                                                                                                                                                                                                                                                                              • ☰ 4.7.3. Docker fundamentals
                                                                                                                                                                                                                                                                                                                • ☰ 4.7.4. Podman vs Docker
                                                                                                                                                                                                                                                                                                                  • ☰ 4.7.5. Container networking
                                                                                                                                                                                                                                                                                                                • ☰ 5. PART V — Server Administration (Expert)
                                                                                                                                                                                                                                                                                                                  • ☰ 5.1. Web Servers
                                                                                                                                                                                                                                                                                                                    • ☰ 5.1.1. Apache basics
                                                                                                                                                                                                                                                                                                                      • ☰ 5.1.2. Nginx basics
                                                                                                                                                                                                                                                                                                                        • ☰ 5.1.3. Virtual hosts
                                                                                                                                                                                                                                                                                                                          • ☰ 5.1.4. SSL/HTTPS
                                                                                                                                                                                                                                                                                                                            • ☰ 5.1.5. Reverse proxy concepts
                                                                                                                                                                                                                                                                                                                            • ☰ 5.2. Database Servers
                                                                                                                                                                                                                                                                                                                              • ☰ 5.2.1. MySQL/MariaDB
                                                                                                                                                                                                                                                                                                                                • ☰ 5.2.2. PostgreSQL
                                                                                                                                                                                                                                                                                                                                  • ☰ 5.2.3. Database backup strategies
                                                                                                                                                                                                                                                                                                                                    • ☰ 5.2.4. Database hardening
                                                                                                                                                                                                                                                                                                                                    • ☰ 5.3. Email Services
                                                                                                                                                                                                                                                                                                                                      • ☰ 5.3.1. SMTP fundamentals
                                                                                                                                                                                                                                                                                                                                        • ☰ 5.3.2. Configuring Postfix
                                                                                                                                                                                                                                                                                                                                          • ☰ 5.3.3. IMAP/POP3 with Dovecot
                                                                                                                                                                                                                                                                                                                                            • ☰ 5.3.4. Spam filtering systems
                                                                                                                                                                                                                                                                                                                                              • ☰ 5.3.5. Email routing concepts
                                                                                                                                                                                                                                                                                                                                              • ☰ 5.4. DNS and DHCP
                                                                                                                                                                                                                                                                                                                                                • ☰ 5.4.1. Understanding DNS
                                                                                                                                                                                                                                                                                                                                                  • ☰ 5.4.2. Setting up BIND
                                                                                                                                                                                                                                                                                                                                                    • ☰ 5.4.3. DNS zones and records
                                                                                                                                                                                                                                                                                                                                                      • ☰ 5.4.4. DHCP server configuration
                                                                                                                                                                                                                                                                                                                                                        • ☰ 5.4.5. DNS troubleshooting
                                                                                                                                                                                                                                                                                                                                                        • ☰ 5.5. Load Balancing
                                                                                                                                                                                                                                                                                                                                                          • ☰ 5.5.1. HAProxy fundamentals
                                                                                                                                                                                                                                                                                                                                                            • ☰ 5.5.2. Nginx as a load balancer
                                                                                                                                                                                                                                                                                                                                                              • ☰ 5.5.3. Session persistence
                                                                                                                                                                                                                                                                                                                                                                • ☰ 5.5.4. High availability concepts
                                                                                                                                                                                                                                                                                                                                                                • ☰ 5.6. Clustering and High Availability
                                                                                                                                                                                                                                                                                                                                                                  • ☰ 5.6.1. Failover principles
                                                                                                                                                                                                                                                                                                                                                                    • ☰ 5.6.2. Pacemaker
                                                                                                                                                                                                                                                                                                                                                                      • ☰ 5.6.3. Corosync
                                                                                                                                                                                                                                                                                                                                                                        • ☰ 5.6.4. Cluster resource management
                                                                                                                                                                                                                                                                                                                                                                          • ☰ 5.6.5. Distributed filesystems
                                                                                                                                                                                                                                                                                                                                                                        • ☰ 6. PART VI — DevOps and Cloud
                                                                                                                                                                                                                                                                                                                                                                          • ☰ 6.1. Linux for Developers
                                                                                                                                                                                                                                                                                                                                                                            • ☰ 6.1.1. Compiler toolchains (gcc, make)
                                                                                                                                                                                                                                                                                                                                                                              • ☰ 6.1.2. Git fundamentals
                                                                                                                                                                                                                                                                                                                                                                                • ☰ 6.1.3. Debugging tools (gdb, strace)
                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 6.1.4. Build automation (Makefile, CMake)
                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 6.2. DevOps on Linux
                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 6.2.1. CI/CD principles
                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 6.2.2. YAML basics
                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 6.2.3. GitHub Actions
                                                                                                                                                                                                                                                                                                                                                                                          • ☰ 6.2.4. GitLab CI/CD
                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 6.2.5. Automated testing
                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 6.3. Configuration Management
                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 6.3.1. Ansible basics
                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 6.3.2. Playbooks and inventories
                                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 6.3.3. Puppet overview
                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 6.3.4. Chef overview
                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 6.4. Infrastructure as Code
                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 6.4.1. Terraform fundamentals
                                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 6.4.2. Providers and resources
                                                                                                                                                                                                                                                                                                                                                                                                          • ☰ 6.4.3. Modules
                                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 6.4.4. Cloud provisioning with Terraform
                                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 6.5. Cloud Computing with Linux
                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 6.5.1. Linux on AWS
                                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 6.5.2. Linux on Azure
                                                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 6.5.3. Linux on GCP
                                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 6.5.4. Cloud networking basics
                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 6.5.5. Scaling and monitoring
                                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 7. PART VII — Master Topics
                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.1. Hardening a Linux System
                                                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 7.1.1. Hardening principles
                                                                                                                                                                                                                                                                                                                                                                                                                          • ☰ 7.1.2. Kernel hardening
                                                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 7.1.3. File integrity monitoring
                                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 7.1.4. Vulnerability scanning
                                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 7.2. Forensics and Incident Response
                                                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 7.2.1. Collecting evidence
                                                                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 7.2.2. Log and file recovery
                                                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 7.2.3. Analyzing suspicious processes
                                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.2.4. Incident response workflow
                                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.3. Performance Tuning
                                                                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 7.3.1. CPU tuning
                                                                                                                                                                                                                                                                                                                                                                                                                                          • ☰ 7.3.2. Memory tuning
                                                                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 7.3.3. Disk and I/O optimization
                                                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 7.3.4. Profiling tools
                                                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 7.4. Writing Linux Tools
                                                                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 7.4.1. Bash-based tools
                                                                                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 7.4.2. Python command-line tools
                                                                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 7.4.3. Writing tools in C
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.4.4. Using Linux system APIs
                                                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.5. Linux Internals
                                                                                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 7.5.1. Process lifecycle
                                                                                                                                                                                                                                                                                                                                                                                                                                                          • ☰ 7.5.2. Memory management
                                                                                                                                                                                                                                                                                                                                                                                                                                                            • ☰ 7.5.3. Signals and IPC
                                                                                                                                                                                                                                                                                                                                                                                                                                                              • ☰ 7.5.4. Namespaces
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 7.5.5. cgroups
                                                                                                                                                                                                                                                                                                                                                                                                                                                                • ☰ 7.6. Becoming a Linux Expert
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  • ☰ 7.6.1. Career paths
                                                                                                                                                                                                                                                                                                                                                                                                                                                                    • ☰ 7.6.2. Certifications (RHCE, LFCS, LPIC)
                                                                                                                                                                                                                                                                                                                                                                                                                                                                      • ☰ 7.6.3. Building a homelab
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        • ☰ 7.6.4. Contributing to open source