Step 7 of 8 · lab · 25 min
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
- The
lab-notesservice runs as the notes user, and the application code stays the same. http://notes.lab.test/answers 200 with a response from the application.- The application socket is not writable by everyone, and nginx runs as www-data, as before.
- 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
The machine is starting
Hints
0 of 3Lab 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
Goals are checked on the machine after every command.