Nginx Rate Limiting in Practice: limit_req and limit_conn — When They Fire and How to Configure Them
In high-traffic scenarios, without constraints on clients a single runaway crawler can drag the backend down. Nginx provides two gates: limit_req throttles request frequency, and limit_conn caps concurrent connections. They look similar but police different dimensions — one governs “how many per second,” the other “how many at the same time.” This post explains when the two modules fire and how to configure them, and uses nginx/1.31.5 container tests to capture three typical behaviors: b...
Nginx location Matching Rules, Verified in Practice: Priority, Regex Order, and Nesting
Which location block handles an incoming request is decided by Nginx’s location matching rules. There are many conflicting accounts of these rules online — “longest match wins,” “regex first,” and other versions circulate, some of them simply wrong. This post tests all four matching modes one by one in an nginx/1.31.5 container and delivers verified priority conclusions: how exact matches hit, what ^~ actually “skips,” whether regex is order-based or longest-based, and how nested locatio...
Getting Started with the Nginx Rewrite Module: Rewrites, Redirects, and Loop Prevention
Jumping old links smoothly to new addresses, routing requests by language — on Nginx these needs all belong to the rewrite module: it modifies the request URI through regex matching and condition checks, and the rewritten result can either go through an internal redirect (invisible to the user) or send the browser off to another URL (returning 301/302). A rewrite rule is only one line long, but the property that “the rewritten URI runs through the matching flow again” regularly walks new...
HDD vs SSD I/O Optimization: Schedulers, Mount Options, and LVM Caching
When server disk I/O won’t go any higher, don’t rush to replace hardware — software-level tuning of the scheduler, mount options, and write caching often delivers noticeable gains. But these techniques must not be mixed across hard disk drives (HDDs) and solid-state drives (SSDs): the two media have completely different bottlenecks. Cutting seek activity for HDDs and cutting pointless writes for SSDs is the medicine each one actually needs. This post walks through the main optimization p...
Deploying a ZooKeeper Cluster: A Three-Node Run on Rocky Linux 9 (with CentOS 7 Differences)
ZooKeeper’s job in a distributed system is unglamorous, but plenty of components can’t run without it: Kafka’s metadata, Hadoop’s high-availability leader election, configuration coordination for all kinds of middleware. Components like this rarely get touched once they go live, so the first deployment is worth doing right. This post records the full process of standing up a three-node ZooKeeper 3.8.6 cluster on Rocky Linux 9.3 — from installing Java to cross-node read/write verification...
The Nginx return Directive: Answering Requests Without Waking the Backend
The site is going down for maintenance and you don’t want users slamming into a wall of backend errors; an old link moved domains and you don’t want to write a single line of redirect code; an intranet liveness probe needs a fixed response and you don’t want to spin up a service for it. What these have in common: no backend involvement whatsoever — Nginx itself can hand out the response. The directive for the job is return, part of the built-in rewrite module (ngx_http_rewrite_module) — give ...
Nginx realip in Practice: Recovering the Real Client IP Hidden Behind a Proxy
When Nginx acts as a reverse proxy, the $remote_addr the backend sees is usually the proxy’s own IP, with the real client hidden in headers like X-Forwarded-For. If logging, rate limiting, or risk control rely on $remote_addr directly, the results are all distorted: bans land on the proxy, and rate limiting counts every user as one. ngx_http_realip_module solves exactly this: it lets Nginx recover the real client IP from request headers sent by trusted proxies. The core is just three directiv...
LVM Logical Volume Management: Concepts, Use Cases, and Building a Volume from Scratch
Once a traditional partition is fixed in place, resizing means touching the partition table — high risk, and often requiring downtime. LVM (Logical Volume Manager) adds a layer of abstraction between physical disks and filesystems, letting storage space be allocated on demand and resized online like memory. This article explains LVM’s core concepts, applicable scenarios, and the complete flow of building a volume from scratch in one pass. Volume creation, expansion, and shrink safeguards were...
Disk Partition Management with parted: From Inspecting and Creating to Resizing
For partitioning a new disk or resizing partitions during expansion, parted is handier than fdisk: it supports both MBR and GPT partition tables, it handles disks larger than 2TB that (older) fdisk cannot, and its command form suits scripts, making it a fixture of automated provisioning. This post walks parted through everyday operations, with every command verified by actually running it on a loop disk (a sparse file posing as a block device) in a Rocky Linux 9.3 container (GNU parted 3.5), ...
Cloud Disk Hot Resizing in Practice: Online Expansion with growpart and resize2fs
A disk running out of space, with no appetite for downtime — that’s exactly where cloud disk hot resizing earns its keep: enlarge the disk from the console, then stretch the partition and filesystem to match inside the system, with service uninterrupted throughout. This post walks the complete flow using a 50GB-to-100GB example. The operation splits into two halves: the platform side is only responsible for making the disk bigger; the three steps inside the system — confirm, stretch the parti...