Exercises
Assess practical knowledge of configuring NGINX as a reverse proxy and load balancer. The quiz covers upstream server groups, balancing algorithms, forwarded headers, URI rewriting, TLS termination, WebSocket proxying, buffering, caching, failure handling, trusted client IPs, graceful reloads, and persistent upstream connections. Questions range from foundational concepts to configuration details and troubleshooting scenarios.
Answer the questions below and check the explanation for each answer.
0/17 answered
Auto audio on: the next questions will be read aloud when you click Continue.
As a reverse proxy, NGINX receives requests on behalf of backend applications and forwards each request to an appropriate upstream server.
$host represents the normalized request host, falling back to the matching server name when necessary. Passing it allows the backend to identify the requested virtual host.
X-Forwarded-For commonly carries the originating client address and addresses added by intermediate trusted proxies.
Round robin distributes requests across available upstream servers in sequence. It is the default method when no alternative balancing directive is specified.
least_conn sends a new request to the server with the fewest active connections, which can improve distribution when request durations differ significantly.
ip_hash selects an upstream using the client IP address, providing basic session affinity. Changes to the server pool can still remap clients.
max_fails sets the tolerated number of unsuccessful attempts, while fail_timeout defines the observation period and temporary unavailability interval.
Proxy buffering lets NGINX consume an upstream response into memory or temporary files while sending it to the client at a different rate. This can protect upstream workers from slow clients.
WebSocket handshakes use HTTP/1.1 upgrade semantics. NGINX must forward the Upgrade header and send a suitable Connection value, usually configured through a variable.
Because proxy_pass includes a trailing URI slash, the matching location prefix /api/ is replaced by /. The resulting upstream path is /users.
A 502 Bad Gateway commonly means NGINX could not obtain a valid response from the upstream, such as when the service is stopped, unreachable, or listening on another port.
proxy_read_timeout controls the permitted interval between successive upstream read operations. It is not necessarily a limit on the total response duration.
With TLS termination, NGINX handles certificate negotiation and decrypts HTTPS traffic before proxying requests onward, often over a protected private network.
proxy_cache_valid 200 10m; defines a ten-minute cache validity period for responses with status 200. A cache zone must also be configured and selected.
Clients can forge forwarded headers. Real-IP processing should therefore accept them only from known proxy addresses or networks configured as trusted sources.
nginx -s reload starts new workers with the updated configuration and gracefully retires old workers after they finish serving current connections.
Upstream connection reuse commonly requires a keepalive pool, proxy_http_version 1.1, and an empty Connection header so NGINX does not request connection closure.
Video Courses
recommended
recommended
recommended
recommended
Thousands of online courses in video, ebooks and audiobooks.
To test your knowledge during online courses
Generated directly from your cell phone's photo gallery and sent to your email
Download our app via QR Code or the links below:.
+ 10 million
students
Free and Valid
Certificate
60 thousand free
exercises
4.8/5 rating in
app stores
Free courses in
video and ebooks