View Single Post
Old 03-05-2021, 10:02 PM   #1
georgehuang
Enthusiast
georgehuang began at the beginning.
 
Posts: 42
Karma: 10
Join Date: Oct 2020
Device: MacBook, iPhone, Kindle Paperwhite
502 Bad Gateway errors on nginx server

I now have Calibre Content Server running with nginx as a virtual host, which has received a SSL certificate from Certbot for security's sake. They all run on Ubuntu 20.04 on a VPS. And I also set up a startup service that runs Calibre:

Code:
/opt/calibre/calibre-server /home/ubuntu/Calibre --enable-local-write --enable-auth --auth-mode "basic" --ban-after 5 --ban-for 5 --log /home/ubuntu/log/calibre.log
Most of the time Calibre runs great, but I get 502 Bad Gateway error about twice or thrice a day. I have logs enabled but calibre.log does not show anything related. nginx's error.log do have reports like:

Code:
[error] 641#641: *1773 connect() failed (111: Connection refused) while connecting to upstream ...
This can be easily fixed by restarting Calibre server, without having to restart nginx. However, that means I will have to ssh into my VPS and run the command, which is not as easy to do when I am out with only a mobile phone.

Any idea why this might happen? Is there anything I can do to fix this?
georgehuang is offline   Reply With Quote