Chapter 6: Web Servers — Nginx and Apache
Practice Questions and Lab Exercises
Come on, practice time! Use a disposable machine for package exercises. Below you can test a private Nginx frontend and its local backend without changing a running website.
चला, आता प्रॅक्टिस! पॅकेजचा सराव वेगळ्या टेस्ट मशीनवर करा. खाली चालू वेबसाइट न बदलता Nginx आणि स्थानिक backend तपासू.
चलो, अब प्रैक्टिस! पैकेज का अभ्यास अलग टेस्ट मशीन पर करें. नीचे चल रही वेबसाइट बदले बिना Nginx और स्थानीय backend की जाँच करेंगे.
- Trace a named static request and a named proxy request to the components that handle them.
- Explain which architecture and configuration features would matter when choosing between Nginx and Apache.
- Find the installed package name, service and effective configuration entry point on an approved practice system.
- Explain when Apache uses a permitted per-directory override and how Nginx loads its site rules.
- Compare the evidence for 403, 404, 502 and 504. Name what would confirm a concrete cause.
- Explain how to check a file label and why a label correction depends on the denial evidence.
- Use the private verification lab to check the named body, fallback, missing route and deliberate upstream timeout.
- On Ubuntu, inspect the available and enabled paths and explain how the configured include reaches the active file.
- On CentOS Stream, identify the applicable SELinux and firewall status before proposing any authorized change.
Quick Revision
- Web servers can serve static content, route sites by name and forward selected paths to backends.
- Nginx uses event-driven workers. Apache's MPM selects its handling model and can permit scoped directory overrides.
- Apache is commonly
httpdon Amazon Linux and CentOS Stream andapache2on Ubuntu. Verify the installed unit and config. - Use the selected site and route to discover the actual root, alias or proxy mapping.
- Current service activity and automatic start enablement are separate. Test the selected candidate before an authorized apply and verify the named request.
- SELinux and firewall checks depend on the system and evidence. A private loopback exercise needs no new ingress rule.
Got it? Install, start, enable, test, reload – these are the five words of a web server. Now let's move on and put the Amul-style dairy's first static website live.
समजलं का? Install, start, enable, test, reload – हेच वेब सर्व्हरचे पाच शब्द. आता पुढे जाऊया Amul-स्टाइल डेअरीची पहिली स्टॅटिक वेबसाइट लाइव्ह करायला.
समझ आया? Install, start, enable, test, reload – यही वेब सर्वर के पाँच शब्द. अब आगे चलते हैं Amul-स्टाइल डेयरी की पहली स्टैटिक वेबसाइट लाइव करने.
Trace the practice pickup request
The client calls the named Nginx frontend. Its pickup rule forwards the request to a second loopback listener. The app can answer promptly or wait long enough for the frontend to return a gateway timeout. A local static schedule does not need that app connection.
Use the release worksheet below to capture the selected host, route, method, status, body and log evidence for each test.
Build a small release check for the practice dairy
Chala, use one small project to put these web server lessons together. The practice dairy has two public pages. A collection schedule is stored as a short text file. A pickup service computes a small text response that answers whether a counter is ready. To a customer both appear under the same website name. A static file should not depend on the pickup process, and a failing pickup request should not stop the written schedule from being served. Your job is to prove that each request takes its intended path and to leave a short repeatable record for the next learner.
The lab runs these services in one private practice setup. The frontend is Nginx, the same type of program that could serve local files and forward selected requests in a deployed system. The backend is a small Python HTTP service. It creates one simple demonstration response and a deliberately slow response. Both processes bind loopback under your regular account. The named requests use a reserved example name supplied explicitly in the HTTP header. No domain registration, additional instance, system service change or cloud security-group rule is needed for this experiment.
Write the request contract before running any commands. An ordinary browser visit to the schedule should return the current date marker from the staff's file. A pickup request should receive the backend's marker. A guessed path that has no content should return 404. An unrelated hostname reaching the same frontend should receive a separate, deliberate fallback. A slow backend route should demonstrate a timeout and the schedule should remain available afterward. Each behavior checks a different part of the arrangement. A release test with only the happy homepage cannot prove that the pickup dependency works or that an unmatched hostname is handled deliberately.
A testable release starts with a scope statement. For this lesson the scope is one isolated HTTP gateway and its one application process on a local learning machine. Your deliverable is a table of expected and observed request outcomes, two relevant log excerpts and a note confirming cleanup. A customer-facing release would also need its own authorized external observations for DNS, network access, TLS and any upstream or caching systems. Those checks would apply to the actual site name and intended route. Keep them in the plan rather than pretending a loopback exercise tested them.
Translate the customer paths into server behaviors
A path is the part of a URL after the hostname and optional port. The path can be routed to a file, a server instruction that returns a simple response or another service. The lab uses /schedule.txt for the file and /pickup for the application. They belong under the same virtual server name. An exact Nginx location for pickup selects the proxy rule only for that route. A general location uses the configured root for ordinary file requests. Draw a route from the named website to each handler before looking at the script.
For the schedule, start with the filesystem calculation. The root points to a private site directory. The request path supplies the filename. A present file under that directory can be opened by the worker using the ordinary lab account. The body will state the current practice release. A second filename is deliberately absent. When the request reaches the file handler, the open failure can be correlated with the matching 404 and actual attempted path. That is the evidence you should expect. The filename is written to a private directory, and no published directory is modified.
For the pickup process, start with a second connection. The client connects to Nginx, then Nginx connects to the configured local upstream port. The process listens on that address and accepts the request. The example uses a proxy target that contains no replacement URI, so the original pickup path can be handled by the backend. More complex Nginx proxy rules can replace the matched path prefix when a URI is included in the proxy target. If an app receives requests at an unexpected path, compare the path in the frontend log, the proxy directive and the upstream application's log before changing what the client sends.
Neither a process listing nor a successful connection to a backend port can prove the request handled the correct route. An HTTP probe with a recognizable result is more specific. Start at the endpoint you intend to ask. Inspect the client-visible response and the gateway log together. For a healthy pickup request the client should get the backend's declared marker and the gateway can record the same successful status for the upstream. For a static file the access log's upstream fields are empty or shown with a placeholder. This helps you demonstrate that one request contacted another process and the other did not.
Practice tracing the fallback in the same model. One address and port accept more than one name. An explicitly marked default site returns a separate message for a nonmatching request. The comparison uses the same connection destination and path while varying the name alone. You can get a 200 from both sites. Once you write the expected body for each, you can tell them apart without assuming the command's success identifies the intended route.
Predict what the deliberate timeout will show
A timeout is a waiting limit. The backend in this exercise accepts one special request and waits before sending any headers. The lesson's Nginx location allows a short interval for reading from that upstream. When no response arrives in the configured reading interval, the frontend can close that connection and send a 504 to the client. This is different evidence from the previous troubleshooting lab's refused connection, which could immediately fail before a backend accepted the request. In your notes, write which phase the error line identifies.
Nginx documents its proxy reading timeout as a limit between successive reads from the upstream. It is not a fixed limit for transferring the entire response. An upstream can continue a longer response by supplying data at suitable intervals. Here the backend sends nothing while it deliberately sleeps, so the first waiting interval expires before the headers appear. The client test itself has a longer limit to give the gateway time to return its error. If the client gives up first, your terminal may report a client timeout with no observed HTTP 504. Keep the two timers separate.
The test isolates a policy fault from a broad process outage. The correct pickup route targets the same app and returns quickly. A direct request to the slow endpoint with a longer wait can return successfully after its planned delay. The proxied route still times out under the exercise's deliberately smaller limit. Compare those observations with the frontend log. This demonstrates why an upstream manager saying running and a direct local request succeeding do not guarantee that a gateway with a particular waiting rule can deliver the result. It also explains why the schedule remains available without contacting the app.
In a production diagnosis, a long wait could involve queueing, CPU, a downstream request or work in another process. Raising the configured limit changes how long clients may wait and may add pressure when many requests are outstanding. The lab controls both timings, so you know the cause. In an actual case, first gather the failing phase, an authorized direct sample where appropriate, and the upstream's own evidence. Choose the change that addresses the customer's intended response time with the team that owns the route.
Run the release worksheet against private services
Use a disposable Linux machine with Python 3.7 or later and Nginx with the separate bootstrap-log option. Copy the complete block into a shell running under your ordinary user. It prints a private frontend port and a private backend port. The frontend port is probed briefly by Python and then bound by Nginx, so another local process could take it first. If Nginx cannot start, the block reports its diagnostic and releases its own temporary resources. Let the existing holder continue running and retry with a fresh port.
Read the setup in three parts before running it. The Python handler knows two pickup routes and can delay one of them. The short generated frontend configuration has a fallback, one named site, the static root and two proxy locations. The final table drives requests and checks the result one row at a time. After the first tests it edits only the schedule file to demonstrate a content update without changing the config, and checks the pickup route again as an unchanged comparison. Both servers and the scratch directory belong to this single Python process.
python3 - <<'PY'
import http.client
import os
from pathlib import Path
import signal
import socket
import subprocess
import tempfile
import threading
import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
if os.geteuid() == 0:
raise SystemExit("Use a regular local account for this exercise.")
subprocess.run(["nginx", "-e", "stderr", "-h"], check=True, capture_output=True)
class PickupHandler(BaseHTTPRequestHandler):
def do_GET(self):
if self.path == "/pickup":
body = b"Pickup counter ready"
elif self.path == "/pickup-slow":
time.sleep(0.8)
body = b"Slow pickup ready"
else:
self.send_error(404)
return
try:
self.send_response(200)
self.send_header("Content-Type", "text/plain")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
except (BrokenPipeError, ConnectionResetError):
pass
def log_message(self, format, *args):
pass
def request(port, path, method="GET", host="dairy.example.test"):
connection = http.client.HTTPConnection("127.0.0.1", port, timeout=3)
try:
connection.request(method, path, headers={"Host": host})
response = connection.getresponse()
return response.status, response.read().decode().strip()
finally:
connection.close()
def check(port, label, path, expected_status, expected_body=None, **request_options):
status, body = request(port, path, **request_options)
print(f"{label}: HTTP {status}" + (f" {body}" if expected_body else ""), flush=True)
assert status == expected_status, (label, status)
if expected_body is not None:
assert body == expected_body, (label, body)
with tempfile.TemporaryDirectory(prefix="nginx-release-lab-", dir=Path.home()) as scratch:
lab = Path(scratch)
site = lab / "site"
site.mkdir()
schedule = site / "schedule.txt"
schedule.write_text("Morning release\n", encoding="utf-8")
with ThreadingHTTPServer(("127.0.0.1", 0), PickupHandler) as backend:
with socket.socket() as reservation:
reservation.bind(("127.0.0.1", 0))
front_port = reservation.getsockname()[1]
backend_port = backend.server_port
print(f"Frontend {front_port}, backend {backend_port}", flush=True)
config = lab / "nginx.conf"
config.write_text(f"""
worker_processes 1;
pid "{lab}/nginx.pid";
error_log "{lab}/error.log" notice;
events {{ worker_connections 32; }}
http {{
log_format release '$host $request_method $uri $status $upstream_status';
access_log "{lab}/access.log" release;
client_body_temp_path "{lab}/body";
proxy_temp_path "{lab}/proxy";
fastcgi_temp_path "{lab}/fastcgi";
uwsgi_temp_path "{lab}/uwsgi";
scgi_temp_path "{lab}/scgi";
default_type text/plain;
server {{
listen 127.0.0.1:{front_port} default_server;
return 200 "Practice fallback";
}}
server {{
listen 127.0.0.1:{front_port};
server_name dairy.example.test;
root "{site}";
location = /pickup {{
proxy_pass http://127.0.0.1:{backend_port};
}}
location = /pickup-slow {{
proxy_pass http://127.0.0.1:{backend_port};
proxy_read_timeout 250ms;
}}
}}
}}
""", encoding="utf-8")
command = ["nginx", "-p", f"{lab}/", "-c", str(config), "-e", str(lab / "bootstrap.log")]
subprocess.run(command + ["-t"], check=True, timeout=5)
backend_thread = threading.Thread(target=backend.serve_forever, daemon=True)
backend_thread.start()
try:
nginx = subprocess.Popen(command + ["-g", "daemon off;"], start_new_session=True)
try:
for attempt in range(25):
if nginx.poll() is not None:
raise RuntimeError((lab / "error.log").read_text())
try:
if request(front_port, "/schedule.txt") == (200, "Morning release"):
break
except OSError:
pass
time.sleep(0.1)
else:
raise RuntimeError("No matching start response from the private frontend.")
check(front_port, "Unknown host", "/schedule.txt", 200, "Practice fallback",
host="outside.example.test")
check(front_port, "Schedule HEAD", "/schedule.txt", 200, "", method="HEAD")
check(front_port, "Schedule GET", "/schedule.txt", 200, "Morning release")
check(front_port, "Missing file", "/missing.txt", 404)
check(front_port, "Working pickup", "/pickup", 200, "Pickup counter ready")
check(front_port, "Gateway read deadline", "/pickup-slow", 504)
check(backend_port, "Direct slow backend", "/pickup-slow", 200, "Slow pickup ready")
update = site / "schedule.next"
update.write_text("Afternoon release\n", encoding="utf-8")
update.replace(schedule)
check(front_port, "Updated schedule", "/schedule.txt", 200, "Afternoon release")
check(front_port, "Unchanged pickup", "/pickup", 200, "Pickup counter ready")
print("\nAccess evidence:")
print("\n".join((lab / "access.log").read_text().splitlines()[-8:]))
print("\nTimeout evidence:")
for line in (lab / "error.log").read_text().splitlines():
if "upstream timed out" in line:
print(line)
finally:
if nginx.poll() is None:
nginx.send_signal(signal.SIGQUIT)
try:
nginx.wait(timeout=5)
except subprocess.TimeoutExpired:
os.killpg(nginx.pid, signal.SIGKILL)
nginx.wait(timeout=5)
finally:
backend.shutdown()
backend_thread.join()
assert not lab.exists()
print("Private frontend, backend and scratch files cleaned up.")
PY
Start with the output's first three successful requests. The unknown name and the course name both reached one socket, but only the correct name returned the schedule. HEAD can confirm a status and headers, and the empty response body is part of its expected outcome. The named GET gives the morning marker. The program includes an assertion for each expected result. If a row fails, read its label first, then isolate whether the status or the body differed. More than one failure can exist, but the first discrepancy is usually enough to begin an investigation.
Now read the first pickup response and the failure. The healthy request reaches the named frontend, takes the ordinary pickup path and receives the backend's marker. The intentionally slow route uses the same app with a shorter read delay at the gateway. In the simulated failure there is a client-visible 504 and a matching Nginx diagnostic about waiting while reading the response header from the upstream. The Python client can wait longer than that limit. The code then asks the private backend directly, which returns a 200 and the expected marker after its delay. This comparison separates the gateway's waiting rule from the app process being absent.
The same-body 200 comparison alone does not reveal why an app had a delay. In this lab you can point to a specific sleep in the handler. On an authorized live app, use the logs and response metrics of the selected service. Preserve its intended authentication and input requirements. Your own desktop may have been faster during one run than another. Use the timeout phase, request and intended endpoint to make the conclusion, and report measured timing separately if you collected it.
When the file update becomes visible, the client sees Afternoon release. The script created new content in the same scratch folder and replaced the original path, so a plain later GET returned the new bytes. No setting, linked config or routing instruction changed. That is why the practice server could serve the updated file without a reload. In a cache-enabled deployment you would also verify its content freshness behavior. The additional pickup check returns the same known marker, which is evidence that the file update did not shift the tested application route.
Grade each row and keep the supporting clue
Create a worksheet with columns for case, method, hostname, request path, observed status, observed body and explanation. Fill the first two rows even if they look nearly identical. The fallback's path does not look for the schedule, because its server directly returns the fallback marker. The named HEAD reaches the schedule route and answers without a response body. The named GET is the first row that can confirm the file's wording. If you leave out method and body, the record can make two different handlers and two different request types appear equivalent.
Under the missing-file case, write which resource should have been absent. In the exercise it is acceptable to record a client 404 and the filesystem lookup for the absent name. In a different service, a loading application, a deliberately hidden object or an upstream status could be part of a 404 investigation. The test does not give the number a single universal cause. The expected negative case also teaches why a test harness should compare against the requested outcome. Treating every non-200 as a failed test would classify the successful absence check incorrectly.
Use the first backend results to fill the difference between frontend and upstream. For the static path the log has no upstream HTTP request data. For the fast pickup path the gateway forwards the request and receives a successful upstream response. For the slow one, write that the gateway timed out while reading the header. The final upstream status field in the Nginx log can record the gateway's result for an upstream attempt, including a timeout. It does not prove the backend itself sent an HTTP 504. The corresponding error line supplies the distinguishing evidence, and the separately tested app route supplies another justifiable comparison.
The exercise supervises the foreground Nginx master it created and closes the practice backend before removing the temporary directory. The printed trailing log excerpts are the record for your worksheet. If you interrupt a process forcibly outside that normal flow, check which owned lab process remains before trying to clean up. Use the private startup command and directory shown for that instance. A process on another port or a production unit is outside this exercise. On a shared machine preserve its services and request that the responsible person inspect any resource outside your lab ownership.
The grade for a completed exercise has four pieces. First, every requested case has its expected result. Second, the file misses, name fallback and upstream timeout are explained by their separate observations. Third, the unchanged route still works after the content update. Fourth, the private resources are released. An explanation that skips the direct slow backend or records only “the site is active” misses the comparison the project set out to demonstrate. A short table with these facts is enough to make the result independently reviewable.
Change one input and revise the experiment
Make your own copy of the code before practicing a change. The first variant asks you to lengthen the private timeout just enough for that intentionally slow result. Find the location for the slow pickup and choose a value such as two seconds, larger than the deliberately introduced delay and smaller than the test client's read timeout. Keep the handler delay and other locations unchanged. Update the expected status and body for that one named route to 200 and Slow pickup ready. Review the small diff so you can say exactly which hypothesis the variant tests.
Run the copied script as a fresh lab. Expect the slow gateway path to succeed, the direct backend path still to succeed, and the fast pickup and schedule checks to remain the same. The previously expected timeout diagnostic is now supposed to be absent. Confirm the current run is the one you inspected by checking the printed port, observations and cleanup. Rerunning from a new scratch directory shows the effect of the candidate setup. It does not demonstrate a live configuration reload. For a live apply comparison, use the prior management lesson's isolated candidate and worker reload steps.
The lesson's use of a larger waiting interval is justified by the precise delay injected into its training backend. On a deployed service, consider the agreed client response time, expected request rates and the source of a delay before choosing a remedy. A higher limit may accept slow work for longer, while the request still fails the customer's deadline. Some systems can return a prompt acknowledgment and complete a long job elsewhere. What matters here is that changing the known timing changes the predicted result, while unrelated paths continue working.
In a second variant, change the article marker to Evening release in only the content update and the matching expected result. Keep the initial marker as morning. A test that accepts whichever body it receives will not detect a mistake, so look up each expectation in the written contract instead of fixing it after observing a failure. Retest both the updated schedule and the unchanged pickup route. Explain why changing a file is mechanically different from changing which app an HTTP location forwards to. You can show both variants from the same baseline without running either against an existing public site.
A third variant is a path exercise. Add a new harmless local file with a predictable marker under a folder called handouts. Request the corresponding named URL and predict the absolute location selected under the current root. Also request a similarly spelled missing filename and expect 404. Adding the file should not require a new proxy route or special module. In your notebook, explain where you would see the resulting path and which part of the access log indicates that this is a static, locally handled request. Keep your extra files beneath the same generated directory so the existing isolated cleanup covers them.
For an optional name variant, design a second accepted classroom host. Decide whether it should share the original handling rules or have another independent server block. To share the site with another recognized name in the classroom exercise, use the same server's accepted names and update the intended test host. To publish a distinct marker, isolate the second site in its own server and ensure the same listener still has a designated fallback. In either case write an unchanged fallback expectation. The direct request header in the exercise lets you prove the selected host without changing DNS records.
Repeat the reasoning with a packaged installation
If you have an authorized disposable machine for each distribution, make a second worksheet for its existing package and unit layout. On Amazon Linux 2023 or CentOS Stream 9, identify the Apache package and service ordinarily called httpd. On Ubuntu, identify the Apache package and service ordinarily called apache2. Record the tool that verifies installed package files on that operating system, the name of the manager unit and the entry configuration selected by the unit. Do not force the same command to work on every environment. Manual builds, containers and newer package arrangements can differ from the lesson's examples.
On the Ubuntu practice machine, inspect the distinction between an available configuration and an enabled one. A site can have a definition under an available directory without being read. The expected enabled entry may be a symbolic link to that definition. Use a read-only directory listing and inspect the pointed-to path where authorized. Then find the include that matches it. This establishes what the candidate would include, while an authorized live response or observed apply still provides the runtime evidence. Write how a missing or dangling link would alter the conclusion. The Ubuntu setup lesson contains a separate temporary example of this arrangement.
On a CentOS Stream learning machine, compare operating-system permission evidence with the status of optional policies. On a system with SELinux tools, examine the actual mode with the supplied read-only command from its lesson. If firewalld is running, record which interfaces and configured zones apply before asking whether a rule is relevant. Can the authorized client already reach the listener along the intended path? If the request is private loopback, external ingress is not needed. If the exercise includes external access, changes to policy belong only to an approved disposable environment with known scope and a restoration plan. For this worksheet an observation and an explanation are sufficient.
Reconcile the printed config layouts with the course path you actually tested. For Apache, find a legitimate configuration test invocation using its wrapper. Identify a valid listener and the virtual host associated with a particular name. For Nginx, find the entry config, included named site and selected location. On each platform, write down where your discussion could be wrong without a request check. For example, a root from a package example can be superseded by the particular site. This is a better exercise than memorizing a universal default path. You should be able to explain how to discover an active path when the defaults change.
A classmate can review this second worksheet without having either distribution by checking your reasoning. You listed the package and unit observed, the file used to start the service, how it includes site configuration and which request would prove the result. You recorded any shell or policy restriction that prevented an observation. Keeping track of constraints is part of the work. An invented file path or pretend exact version weakens the deliverable. In an interview, it is fair to name one verified example and explain which checks you would repeat for an unfamiliar deployment.
Write a two-minute runbook for the next learner
A runbook is a small repeatable description of how to confirm or restore a known behavior. Begin yours with the intended site name, which frontend path serves the schedule, and which paths go to the private backend. Define what counts as good for one static and one backend route. Include the method, body marker and expected status. Next record the actual markers before the proposed change. This gives the team a baseline. If a backend path is supposed to fail in the practice case, explain why it was included and what the error should be. An unlabelled error can be mistaken for a real outage.
Then describe the validation order. Read the exact config scope. Review and preserve the current version of any file it will change. Run the intended syntax check on the candidate with the correct binary, config selection and needed environment. On a successful check apply via the service's authorized procedure if a configuration change is involved. Keep the earlier version in a known place outside live include patterns. After apply use the intended name and path. The status, distinctive body and small comparison create a stronger release check than a single generic response.
Describe two failure branches. If the candidate fails parsing, keep the running version and fix the candidate. If syntax is accepted but a particular request has a wrong result, compare that route and its neighboring known good path, record the logs and decide whether an authorized targeted restore is appropriate. A configuration restore itself requires validation and a response check. If testing reveals a policy or listener owned by another person, hand over the evidence for that role. The runbook should never list “restart every process” as its only response to a discrepancy. Different observations point to different handlers.
Finally specify what cleanup should prove. In the local exercise the program quits the private frontend, closes the backend and removes the temporary path it created. In a provider environment an assigned study resource may have independent cost and ownership. A temporary lab is complete when its documented resources are accounted for and only the designated changes have been reverted or retained with approval. A shared running service is never a cleanup target just because it listened during the exercise. For the final handoff, tell a partner which observed rule or endpoint changed and which comparison stayed the same.
Choose a practice task and show your work
Draw the two request paths. Draw where the student connects, how the host selects a site and how the path selects the file or proxy. Include the second local connection on a pickup request. Draw where the status and body pass back to the client. Your sketch passes when a partner can point to the connection that waits during the slow route and the connection that delivered its result to the student. A drawing with two boxes called server and app should also say which step reads the schedule.
Translate a simple Nginx site into Apache decisions. Describe a Listener address and port, a VirtualHost eligible for that destination, a ServerName and a DocumentRoot. Explain which directory authorization is intended for the one public schedule. You can write the structure on paper. A successful answer distinguishes opening a port from selecting a virtual host and names the relevant installed package wrapper for validation. If you use a hypothetical installation, label the paths as examples. If you run it on the matching approved machine, use a separate local configuration and inspect a distinctive body.
Discriminate a route error from an app process failure. Start from the worksheet observation that one upstream route returns 504 and the private direct route returns 200. Explain the selected timeout rule, the waiting phase in the error and the request duration the client permitted. Compare that with a separate case that reports connection refused. Your solution passes when you can distinguish a hold after an accepted request from absence of a suitable listener. You must name the log evidence behind the distinction instead of assigning a universal cause to every status.
Review an update that only changes customer wording. Compare the morning and afternoon schedule results and the stable pickup result. Decide whether a service reload was necessary in the fixture. Then name a different type of update for which validation and a service apply matter, such as changing the configured root or proxy destination. A strong explanation connects each kind of update to who must reread it. The review should mention that an intermediary cache or a different configured site could affect what a real visitor observes.
Write a preflight failure branch. Imagine the candidate picked the wrong directive context and the syntax check reports an error. Write the three things you would preserve: the running deployment, the reviewed working copy, and the diagnostic. Decide how you would prove the original route remains available without making the candidate live. Then explain why the first reported line might be later than the missing delimiter. Your checklist passes when it specifies the intended config path and makes the runtime probe separate from the parsing check.
Plan the public verification without changing the private lab. Write which authorized external client and exact name would verify an actual deployment. Include the expected TLS certificate name, the correct visible body and one needed asset or proxied path. If both address families are part of the service contract, say how you would compare them. Your plan passes when a partner can tell what a loopback test proved and what remains to be tested through the real path. No new firewall rule is necessary to write this plan.
Explain your practice results aloud
Why can the schedule still work when one pickup route times out?
The named frontend serves the schedule by reading its local file. The special pickup path contacts a different process through the proxy, and its rule has a shorter wait than the deliberate app delay. The gateway can fail to deliver that route while local file handling works. I would show the static marker before and after the failure and the matching error that names the upstream read phase.
Which observation confirms the app received a request and eventually produced a response?
The direct local GET to the app's intentional slow route returned its specific marker after the controlled delay. That confirms behavior for the direct test, under its client time limit. The frontend 504 concerns the separately logged proxied attempt and its shorter read wait. If I needed to prove the exact proxied request reached the handler in a deployment, I would also correlate the app's own observations for that request.
What would you include in a release verification beyond the first 200?
I would check the required hostname and method, the expected body marker on the changed route, one dependent path and an unchanged comparison. If the change adds an intended negative case, I would check that too. I would match a small log excerpt to my request. A browser can show a 200 fallback or an old version, so the content and host clarify what succeeded.
Why not claim the timed-out upstream returned an HTTP 504?
The diagnostic says the gateway timed out while waiting for the upstream's response header. The client saw a gateway-generated error. Although the status fields help link the two paths, the evidence does not show an HTTP response from the app for that timed-out request. The app's direct response is a separate observation with a different wait budget.
What if the file update is visible locally but users still see the morning result?
I would check the actual user hostname, path and destination, then repeat an authorized probe through their usual frontend. I would compare redirects, caches and response markers with the direct origin result. The local test established that one origin file was updated. It leaves open whether a different target, a cache or another deployed revision handled the normal request.
How would you recover after the wrong config file was applied?
I would identify the changed scope and preserve evidence of the failing path. Restore the known correct files or links using the agreed maintenance procedure, validate the effective configuration again and apply it to the intended service. A fresh named request and unchanged comparison verify recovery. If another owner manages part of the config, provide the evidence and use their restoration procedure.
Check the expected result before running it
A HEAD and a GET to the same static path both show 200. Which can prove the new text marker?
Answer and reasoning
The GET provides the body you can compare with the expected release marker. HEAD still has useful header information and its expected body is empty. The worksheet preserves the method to explain why its two successful responses have different evidence.
The client waits three seconds while the proxy allows a quarter second between upstream reads. The backend delays its first header beyond the proxy wait. Which timer gives the result you expect?
Answer and reasoning
The proxy's reading interval should expire first, so it returns its gateway error before the client's three-second wait ends. The direct backend test is separately allowed the longer client wait. This is an inactivity limit between reads, and the fixture sends no data before its planned delay.
Why does the fallback's 200 not complete verification of the schedule?
Answer and reasoning
The fallback reaches a different server block and returns a fixed marker. The schedule is served by a named site and actually opens the file. Compare hostname and response body while holding the frontend address and port constant.
Which evidence shows that the unchanged pickup route still worked after the file update?
Answer and reasoning
Make a fresh GET to the same named pickup path and verify both status and the pickup marker. The schedule result only establishes the file handling path. A direct app result alone would bypass the proxy comparison you need.
A peer wants to add the practice app's port to the public security group so their loopback test works. What should they do?
Answer and reasoning
Run the client on the same machine that hosts the private lab and use its printed loopback port. A public security rule does not make a loopback listener listen on a public interface, and opening it is outside this exercise. Verify the actual process address and test scope instead.
Swap worksheets with a partner and have them underline every statement the experiment actually observed. Underline the two named successful bodies, the deliberate fallback, the logged timeout, the direct comparison and the supported change in content. Circle the assumptions that would need another observation in a deployed system, such as which certificate a load balancer presents or which target a public request reached. This short review helps keep a completed local run from being mistaken for a public release. If the other person can rerun the private exercise and reach the same interpretation, your notes are specific enough to support the next lesson.
Cards for release practice
Predict before testing
A case has a name, method, path, status and expected marker. Write those results before you run a command.
Static paths and backend paths can differ
A static file uses local mapping and permissions. The proxy path also needs the expected upstream handler and protocol.
Match the timeout to its phase
The proxy can reach an upstream and still stop waiting before it supplies a header. Compare the precise log with the direct result and wait limits.
Separate file release from routing change
A static file can change content under the same mapping. A config change needs review and the appropriate application step before request verification.
Keep the proof and remove the lab
Save the meaningful status, body and error observations. End the processes and files created by the exercise when you are done.
Official references
- Nginx listener, server and location selection
- Proxy paths and idle read intervals
- Access log format and request context
- Upstream status and diagnostics context
- Scoped Nginx master controls and graceful shutdown
- Apache address and name selection
- HTTP requests, HEAD and response semantics
- Python demonstration HTTP server
- Python control of its own child process