Linux Labs

Web stack / Stage 2 of 9

Reverse proxy and 502

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 8 · lab · 25 minmedium

Set up an nginx reverse proxy

The backend listens only on 127.0.0.1:3000 — publish it through nginx on port 80.

Situation

The inventory-api backend runs on the server. It listens only on 127.0.0.1:3000, so other machines cannot reach it. You have been asked to publish it through nginx, which is already installed on the server: requests on port 80 should go to the backend, and its response should go back to the client.

Task

  1. The nginx configuration passes nginx -t, and the nginx service is running.
  2. nginx accepts requests on port 80 on every address of the machine.
  3. nginx passes any request to http://localhost/ to the backend and returns its response.

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 nginx configuration is valid — not done yet
  • The nginx service is active — not done yet
  • nginx listens on port 80 on every address of the machine — not done yet
  • Requests to http://localhost/ are answered by the inventory-api backend — 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 nginx configuration is valid — not done yet
  • The nginx service is active — not done yet
  • nginx listens on port 80 on every address of the machine — not done yet
  • Requests to http://localhost/ are answered by the inventory-api backend — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 4
  • The nginx configuration is valid — not done yet
  • The nginx service is active — not done yet
  • nginx listens on port 80 on every address of the machine — not done yet
  • Requests to http://localhost/ are answered by the inventory-api backend — not done yet
Loading…