Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Nginx assessment: publish and operate a service

  • 150 min

By updated

Improve this page

This assessment closes the Nginx module: you are handed an empty Nginx and a set of requirements, and you deliver a static site and an API published over HTTPS, protected, observed, able to survive an unknown incident and then a lost configuration. It is meant for someone who has followed the module, from Install Nginx to Upgrade, roll back and reboot Nginx, and it draws on their skills without recalling any of them. Allow two and a half hours, in one sitting.

The bench runs on Debian 13 with Nginx 1.31.8 installed from the nginx.org repository, the one used in the lessons. Certificates come from a local test ACME authority, Pebble, through the lego client, already present as a pinned container image. Everything you write is your own: no starting configuration shows you the expected form.

What you will learn

The assessment teaches no new skill. It teaches you to put together on your own the skills of the module, on a need you discover, and to keep it running when something breaks. You will be able to:

  • Publish two names over HTTPS with a strictly validated chain
  • Renew a certificate in a verifiable way, without restarting Nginx
  • Defend an access policy against requests that try to bypass it
  • Operate a service with a log, a status page and an alert
  • Diagnose an unknown incident and repair it with the smallest change
  • Prove a recovery plan with a restore followed by a reboot

The need

A product team wants to put a static site online at www.epreuve.test and an API at api.epreuve.test, served by the Nginx of the edge.lab machine. The site content and the API are already on the machine; nothing else exists, no Nginx configuration, no certificate, no backup, no alert. The bench describes itself in /opt/pub-epreuve-nginx/LISEZ-MOI.txt and in /home/student/README-epreuve.

You work from edge.lab on the operator side, and from poste.lab, the independent client, to prove what a visitor really receives. The API is the backend that Nginx relays, and it is not yours: its code is checked, and everything you do happens around it, in the proxy or on the system.

The mission unfolds in five stages. You publish, you set the policy, you make the service operable, you report on your acceptance test before facing an incident, then you prove your recovery. The fourth stage has a twist: writing /home/student/recette-initiale.md is what releases the incident. A few seconds later, something changes on the machine, and nobody tells you which layer is affected.

The constraints

Each requirement is proven by an observable state of the machine, never by a claim. A configuration that passes nginx -t says nothing about the service: only the response obtained from the client describes it. The table sums up what will be required, in the order of the mission.

#RequirementWhat will be observed
1The service is publishedthe right content per name, strictly validated HTTPS on both names, HTTP redirected, an unknown name that serves nothing
2The renewal renewsa new serial served after renewal, without restarting Nginx or changing the ACME account
3The policy holds/admin closed without the right credentials, hidden files never served, only GET and HEAD accepted on the API, backend unreachable from the network
4The cache is safethe public API response spares the origin, and two alternating sessions never see each other's data
5The service is operablethe long stream /v1/flux delivered at the backend's pace, a JSON log whose durations measure, a local status page, an alert that fires then clears
6The incident is repairedthe layer and the component at fault named, the service back without any guarantee lost
7The recovery is provenconfiguration and certificates restored identically, then the full acceptance test passes again after a reboot, with no intervention

Two details avoid a bad surprise. To test the recovery, the validation destroys /etc/nginx/conf.d and the files pointed to by your ssl_certificate and ssl_certificate_key directives: your backup must therefore cover them, with their permissions. And the test authority loses its root at every reboot, by design: the validation keeps the root fetched before the reboot and never asks for another renewal after it.

What you must deliver

The validation cannot guess the mechanism you choose: it calls four fixed entry points and measures their effect. They all run as root on edge.lab, and you write them as you see fit.

Entry pointWhat it must do
/usr/local/bin/renouveler-certificatsrenew the certificates of both names and put the new serial into service with a reload, using the same ACME account
/usr/local/bin/sauvegarder-serviceback up what is needed to bring the service back
/usr/local/bin/restaurer-servicerestore it, whether Nginx is running or stopped
/usr/local/bin/sonde-alerteexit with 0 when the service is healthy, with a non-zero code otherwise, and come back to 0 within 90 seconds after recovery

Some locations are imposed, because a check must find them without searching. The JSON access log is written to /var/log/nginx/epreuve.json, and each line carries at least status, request_time and upstream_response_time. The status page answers on http://127.0.0.1:8081/nginx_status. The ACME client keeps its data under /opt/pub-epreuve-nginx/lego, its account in accounts/, and drops the HTTP-01 challenge tokens into /opt/pub-epreuve-nginx/defi, which Nginx must serve.

Two written files complete the state of the machine. The report /home/student/recette-initiale.md says what your acceptance test checked before the incident. The diagnosis /home/student/incident.yaml carries three fields, couche, composant and explication. The layer takes one of four values, amont, tls, droits or entetes, and the component names the single faulty piece. The hypotheses you ruled out belong in the explanation, not in the component: naming several layers at once is not a diagnosis.

How to assess yourself

The automated check grades facts against the real state of the machine; your reasoning is read by a reviewer. A machine can check that a certificate has changed serial, it cannot judge whether your explanation holds up. The two assessments are therefore separate, and a green check does not replace the review.

What the check measures, area by area:

  • publication, critical: the right content on each name, the strictly validated chain, the redirect from HTTP to HTTPS, and a renewal that serves a new serial with private keys unreadable by other accounts;
  • policy, critical: administration refused without credentials or with a wrong password, forged identity headers, hidden files, unused methods, direct access to the backend, and a cache that never mixes two sessions;
  • operations: the pace of the long stream, log durations that match facts the validation triggers, a status page reserved to the loopback, and the alert in both directions during a controlled backend failure;
  • incident, critical: the right layer, the right component without naming another layer, an explanation present, a service that answers again several times in a row and no guarantee lost along the way;
  • recovery, critical: a certificate back identical with its key closed, then the full acceptance test passing again after a reboot.

What is read and not graded: the quality of your acceptance report and the reasoning of your diagnosis. A failed requirement does not call for a ready-made solution, because no answer key appears in the lessons. Go back to the lesson that teaches the missing skill, then start again from a clean state.

Hands-on: take the assessment

The assessment runs in the lab, between edge.lab and poste.lab. It takes about 150 minutes and gives no hint during the session. The validation grades it with nine checks covering the five areas above. Start it when you have time to finish it in one go.

Key takeaways

An end-of-module assessment proves a state and a line of reasoning, not a configuration.

  • A published service is proven from an independent client, with TLS verification intact.
  • A renewal only counts if the served serial changes, without a restart.
  • An access policy is proven by its refusals, including against forged requests and sessions crossing in the cache.
  • A diagnosis names one layer and one component, with the ruled-out hypotheses as support, and its repair removes no protection.
  • A backup only counts once restored, then tested by a reboot.