Systems Administrator

Case File: The Public Page

Sabi Logistics is putting a parcel-tracking page on the internet and the first nginx config will not even start. Fix it so the right site is served from the right folder, visitors cannot browse the files, hidden files stay hidden and the server does not announce its version. The configuration is generated for you alone.

40 min

Sabi Logistics · Case 1

The Public Page

A page for thousands of customers goes live today, and it must not leak the company's files

Ngozi Lead developer · Phone call

Ngozi. The tracking page is finished and the files are on the server. Chidi wants it public by lunchtime, and I have never written an nginx config in my life, so I copied one from a forum post. nginx refuses to start with it.

I do not only want it working. I want it so that when someone nasty looks at it, there is nothing to find. Can you sort out the config properly?

The brief

What you need to know first.

  • A server block is one website. nginx picks it by the port in listen and the name in server_name.
  • root says which folder holds the files. index says which file is the front page.
  • location / { try_files $uri $uri/ =404; } means: serve the file if it exists, the folder’s index if it is a folder, otherwise a clean 404.
  • autoindex on; turns on directory listings. Strangers find old backups that way. Leave it off.
  • Files whose names start with a dot (.git, .env) often hold secrets. Block them.
  • server_tokens off; stops nginx announcing its exact version to every visitor.
  • Every directive ends with a semicolon, and every { needs its }. One missing character and nginx will not start. Always run nginx -t before you reload.

Edit the file below until every requirement is met. The checker reads the file the way nginx would: it does not care about spacing or the order of lines that do not depend on each other.

The flag: when everything is met your change ticket reference appears. Submit it at the bottom of the page.

Preparing the server…

🔒 The debrief unlocks when you close the case. Finish the lab above.

Write the change note

Write what you changed in this configuration and why: the folder and names it serves, what you switched off or blocked and the reason for each, and how you would test it on the real server before and after the reload.

0 words

🧪 Want to practise this on your own computer? See how to set up your lab →

📝

Knowledge Check

1 of 3

A request arrives for http://track.sabi-logistics.example/. How does nginx decide which server block answers?

Report a problem

About: /lessons/case-the-public-page