Linux Labs

Web stack / Stage 2 of 9

Reverse proxy and 502

Not running Starting usually ~20 s
Leave the lesson

Step 1 of 8 · on a machine · 5 min

The shop answers 502

What you will learn

  • Tell an nginx answer from an application answer and find the failed leg from error.log.
  • Send requests to an application with proxy_pass and test the second leg directly.
  • Predict the path an application will get behind location and proxy_pass.

The company's online shop is the lab-shop application on the server, and people open it through nginx by the name shop.lab.test. After an application update the site stopped opening.

Check whether the application is running, then open the site. “Start” will set up the server.

Exercise · look

Open the shop

Check whether the shop application lab-shop is running, then open the site shop.lab.test.

First, predict

The application is running. What will the first line of the curl -i answer be?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in
Check yourself 1 question

Who produced the 502 Bad Gateway answer?

  • systemd starts services and writes no HTTP answers: the Server header says nginx.

  • The Server header and the bottom of the page say nginx/1.24.0 (Ubuntu): the answer came from nginx.

  • curl prints what it received. It reports its own errors as a curl: (7) … line, while here there is an HTTP answer with Server: nginx.

nginx produced the 502 Bad Gateway answer: its name is in the Server header and at the bottom of the page.

Ubuntu 24.04
Loading…