A starting point for anyone learning web service infrastructure for the first time. It covers the roles of DNS, load balancers, reverse proxies, and caches on the path a user request takes to reach the server, how to scale a system as traffic grows, where Nginx and Redis sit in the architecture, and a step-by-step learning roadmap.
Beginner
Updated Oct 1, 2026
~7 min read
11 sections
1 code examples
π§
The big picture of web infrastructureUnderstand the request flowThe roles of Nginx and RedisScaling strategy basicsInfrastructure learning order
Understanding Infrastructure Intro & Roadmap as a real-world workflow
A starting point for anyone learning web service infrastructure for the first time. It covers the roles of DNS, load balancers, reverse proxies, and caches on the path a user request takes to reach the server, how to scale a system as traffic grows, where Nginx and Redis sit in the architecture, and a step-by-step learning roadmap. Rather than listing concepts, this guide is organized so you can follow the content in the order you have to make decisions on a real project.
Key perspective
Infrastructure / operations
Rather than memorizing install commands, understand the order in which traffic, runtime, observability, and incident response connect.
The big picture of web infrastructureUnderstand the request flowThe roles of Nginx and RedisScaling strategy basicsInfrastructure learning order
Architecture diagrams
To make what you read stick, it helps to capture the flow as a picture first. The two diagrams below are reference maps you can keep coming back to while learning Infrastructure Intro & Roadmap.
Learning flow
Rendering diagramβ¦
Architecture view
Rendering diagramβ¦
What infrastructure is
When you first open Infrastructure Intro & Roadmap, the big picture matters more than individual commands. This section starts with the problems the concepts ahead were created to solve.
Infrastructure is everything that supports an application so that it runs, connects to users, and responds quickly and reliably. That includes servers, networks, load balancers, caches, storage, and certificates.
However good the application code is, weak infrastructure means the service stops when traffic surges. Well-designed infrastructure, on the other hand, lets the same code serve tens of times more users. This category covers the two pieces that show up in almost every web service β Nginx (the gateway for traffic) and Redis (the key to speed).
The path a request takes is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
When a user opens https://shop.example.com/products/42, the request passes through several layers. Each layer either handles it quickly and returns or passes it on to the next layer. The earlier the layer that handles it, the faster and cheaper it is.
Order
Layer
When the request can end here
1
Browser cache
Images and CSS already downloaded are not requested again
2
DNS
-
3
CDN (edge)
Static files and cacheable pages are answered immediately at the edge
4
Nginx (reverse proxy)
Serves static files directly, blocks requests over the rate limit
5
Application server
-
6
Redis (cache)
On a cache hit, answers without a DB query
7
Database
The final store β the slowest and most expensive layer
Reverse proxies and load balancers: where Nginx sits
Reverse proxies and load balancers: where Nginx sits is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
A reverse proxy is a server that stands between users and the application servers, receiving requests on their behalf and forwarding them. Users cannot tell how many servers are behind it or what language they are written in. Nginx is the most widely used reverse proxy and web server.
What Nginx does
Description
TLS termination
Handles HTTPS encryption and decryption, taking the load off the app servers
Load balancing
Distributes requests across several app servers (round robin, least connections, and so on)
Static file serving
Answers images, JS, and CSS directly without going through the app server
Rate limiting
Limits requests per second per IP to soften excessive traffic and attacks
Path routing
Sends /api to the backend and / to the frontend
Compression Β· caching
gzip compression, response caching
Your first Nginx config: HTTPS + load balancing
Here you look at Your first Nginx config: HTTPS + load balancing alongside real code. Rather than copying the example as-is, read it with an eye on the inputs, the outputs, and the parts most likely to change.
The configuration below distributes HTTPS requests across two app servers, while Nginx answers static files itself. Most real-world Nginx configurations are variations on this structure.
/etc/nginx/conf.d/app.confNGINX
upstream app_servers { least_conn; # to the server with the fewest connections server 10.0.0.11:8000; server 10.0.0.12:8000;}server { listen 443 ssl; server_name shop.example.com; ssl_certificate /etc/letsencrypt/live/shop.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/shop.example.com/privkey.pem; location /static/ { # Nginx serves static files itself root /var/www; expires 7d; } location / { # everything else goes to the app servers proxy_pass http://app_servers; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; }}
Caching strategy: why Redis is fast
Caching strategy: why Redis is fast is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Redis is a key-value store that keeps data in memory. It is tens to hundreds of times faster than a disk-based DB, which makes it a good home for data that is read often but changes rarely. Memory is expensive and volatile, though, so the basic rule is "the original lives in the DB, the copy lives in Redis".
Usage pattern
Example
Key point
Read cache (Cache-Aside)
Product detail, popular posts
On a miss, read the DB and store the result; set a TTL
Session store
Login sessions
Several servers share the sessions
Rate limit counter
Limit API calls per second
INCR + EXPIRE as atomic operations
Leaderboard
Real-time rankings
Sorted Set
Distributed lock
Prevent duplicate payments and duplicate issuance
SET NX + an expiry
Messages Β· streams
Simple job queues, events
List, Pub/Sub, Stream
Scaling strategy: when traffic grows 10x
Scaling strategy: when traffic grows 10x is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
The precondition for horizontal scaling is that the application servers hold no state. Sessions or uploaded files kept in server memory or on its disk vanish when a request goes to a different server. That is why moving sessions to Redis and files to object storage is the first step in scaling.
Strategy
How
Pros
Limits
Vertical scaling (scale-up)
Raise the server spec
No code change, the easiest
Cost climbs fast, there is a ceiling, single point of failure
Horizontal scaling (scale-out)
Add servers + a load balancer
Unlimited in theory, fault isolation
The app has to be stateless
Caching
Fewer DB requests through Redis and a CDN
A big effect for little cost
Data freshness has to be managed
Read replicas
Spread DB reads across replicas
Effective for read-heavy services
Replication lag
Async processing
Move long-running work onto a queue
Faster responses
Results have to be tracked
Before you start
Before you start is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Nginx and Redis start in seconds with Docker, so a practice environment is very easy to set up.
Step-by-step roadmap is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
6-week study plan: 1 hour a day is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Do not skip the load test in the last week. Seeing in numbers how much caching and load balancing really help is what builds an instinct for infrastructure.
Week
Topic
Deliverable
Week 1
Networking, HTTP, TLS basics
Notes analyzing the request flow with curl and developer tools
Common mistakes of infrastructure beginners is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Always remember that Redis processes commands on a single thread, so one long-running command can block every request.
Mistake
Problem
Do this instead
Missing X-Forwarded-* headers behind the proxy
The app sees every request as coming from the proxy IP over HTTP
Pass the original information with proxy_set_header
Restarting after a config change without a syntax check
The whole service goes down
nginx -t, then reload
Using Redis as the system of record
Data lost on restart or failure
The original lives in the DB; Redis is a cache and a helper
Cache keys with no TTL
Memory exhaustion, stale data
An expiry on every cache key
Using the KEYS * command
All of Redis stalls with a large number of keys
Use SCAN
Exposing Redis externally without authentication
Data theft, server takeover
Internal network only + password/ACL
Key terms
Key terms is a point where the options diverge. Using the table to compare what each approach is for and how it differs in operation makes later decisions much easier.
Term
One-line explanation
Reverse proxy
A server in front of your servers that receives requests on their behalf and forwards them
Upstream
The group of backend servers Nginx forwards requests to
TLS termination
A setup where the proxy decrypts HTTPS and forwards plain HTTP internally
TTL
How long cached data stays valid
Cache hit rate
The share of requests answered straight from the cache
Cache stampede
Caches expiring at the same moment so that requests flood the DB all at once
Stateless
The server stores no state between requests, so any server can handle any request
Health check
A periodic request that checks whether a server is healthy
Rate Limiting
Limiting the number of requests allowed in a period of time
CDN
A network that caches content on edge servers around the world and serves it from nearby
Follow the path a request takes from the user to the server: DNS and HTTP, the reverse proxy (Nginx), the application server, the cache (Redis), and the database. Once you understand what problem each component exists to solve, moving on to Docker and the cloud connects naturally.
What is the difference between a reverse proxy and a load balancer?
A reverse proxy receives client requests on behalf of the servers behind it and forwards them, and a load balancer spreads requests across several servers. In practice one product often does both. Nginx is a reverse proxy that can also load balance.
When should I introduce a cache?
When the same data is read repeatedly, is expensive to produce, and showing a slightly stale value is acceptable. A cache brings the problems of values drifting from the source and of managing expiry, so first check whether better queries and indexes solve it.