Nginx "Bad gateway" after restarting TinyPilot
See original GitHub issueThere seems to be an issue where nginx will report "
Repro steps
- Start a TinyPilot device normally
sudo service tinypilot restart
- Visit http://tinypilot/
Expected
TinyPilot web interface loads normally.
Actual
Nginx reports “Bad Gateway”
Workaround
Restart nginx:
sudo service nginx restart
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
502 Bad Gateway nginx/1.14.2 - TinyPilot
SSH to the IP address I get connection refused from an IP on the same subnet. Is this system required to have Internet...
Read more >Fresh install, no joy: Nginx error 502 - TinyPilot
Fresh install, no joy: Nginx error 502 ... Error 502 on new install ... tinypilot restart mv: cannot stat '/home/tinypilot/.flask-secret-key': No such file ......
Read more >can't connect - TinyPilot
502 Bad Gateway ... Enable SSH and run the following command. ... /home/tinypilot/old-flask-secret-key && \ sudo service tinypilot restart.
Read more >TinyPilot
Issued a reboot to the system and after reboot, trying to connect to the web service results in a 502 bad gateway.
Read more >Service doesn't start after install - TinyPilot
I see a 502 Bad Gateway error and the log shows the following: Connection refused) while connecting to upstream, client: 192.168.100.103, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
“Bad gateway” is actually a valid answer during the reboot and shouldn’t be confused with “Gateway Timeout”. A gateway timeout is that the service is running, but not providing an answer within the specified timeframe. Can be increased as mentioned by somik but this will not solve a “Bad gateway” issue. A Bad gateway happens when Nginx tries to connect to the service but for some reason, that port is not up, blocked or tcp session could not be set up or any other reason.
So I assume Nginx is running before the service is ready? For this, there are a few possible ways to avoid this:
I’d see lines like this:
But I confirmed a fix in https://github.com/mtlynch/ansible-role-tinypilot/pull/27