Linux Labs

Web stack / Stage 2 of 9

Reverse proxy and 502

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 8 · lab · 25 minmedium

Fix 502 Bad Gateway

The notes service is running, but the site in front of it answers 502. Find where the path from nginx to the application breaks and fix it so that the site survives a service restart.

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.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 4
  • The lab-notes service runs as notes, and the application code is unchanged — not done yet
  • http://notes.lab.test/ answers 200 with a response from the notes application — not done yet
  • The application socket is not writable by everyone, and nginx runs as www-data — not done yet
  • The site still answers after the application restarts — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

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

Lab goals

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