Linux Labs

Web stack / Stage 2 of 9 · step 7 of 8

Fix 502 Bad Gateway

medium ~25 min
Not running Starting usually ~20 s
Report a problem

Situation

The server runs an internal notes service: the notes-app application, the lab-notes service. nginx makes it available to users under the name notes.lab.test. After the service was updated, the site answers 502 Bad Gateway, even though systemctl status lab-notes shows the service running.

The name notes.lab.test is in /etc/hosts and points to this same machine, so you can run curl http://notes.lab.test/ right here.

Task

  1. The lab-notes service runs as the notes user, and the application code stays the same.
  2. http://notes.lab.test/ answers 200 with a response from the application.
  3. The application socket is not writable by everyone, and nginx runs as www-data, as before.
  4. The site still answers after the application restarts: sudo systemctl restart lab-notes.

There is no internet on the machine; everything you need is already installed. Run administrative commands with sudo.

Visible only to you. Saved as you type.

All notes

Lab goals

0 of 4
  • The lab-notes service runs as notes, and the application code is unchanged — not checked yet
  • http://notes.lab.test/ answers 200 with a response from the notes application — not checked yet
  • The application socket is not writable by everyone, and nginx runs as www-data — not checked yet
  • The site still answers after the application restarts — not checked yet

Hints

0 of 3 open · they open one at a time
Hint 1
Show the solution after 3 failed checks

Leave the lab?

The machine keeps running for 10 more minutes, then it is removed. Files are lost; completed goals stay.

Loading…