- nginx produces
502 Bad Gateway: the leg from the client to nginx worked, and the leg from nginx to the application did not. - nginx writes the cause on the second leg to error.log: the upstream address and a code — 111 nothing listens, 2 no socket file, 13 no permission for
www-data. - You test the second leg separately, with a request to the application from the server itself.
- A path after the port in
proxy_passreplaces the prefix matched bylocation: with/the application gets the path without the prefix. - The shop answered 502 while it was running: nginx sent requests to port 8000, and the application listened on 8001.
Step 8 of 8 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson