Difference between revisions of "Fix a 502 Bad Gateway error on calibre-web"
m (Simon moved page Fixing a 502 Bad Gateway error on calibre-web to Fix a 502 Bad Gateway error on calibre-web without leaving a redirect) |
|||
Line 2: | Line 2: | ||
Sometimes, when making changes to the server settings in the calibre-web browser interface, you may get a 502 error. This means that the server isn't responding to HTTP requests. This quick-fix assumes you have SSH access to the machine you are running calibre-web from. If you have local access, even better, you can just restart the server directly. | Sometimes, when making changes to the server settings in the calibre-web browser interface, you may get a 502 error. This means that the server isn't responding to HTTP requests. This quick-fix assumes you have SSH access to the machine you are running calibre-web from. If you have local access, even better, you can just restart the server directly. | ||
Connect to the server. In my case, I have the hostname set as ''parallel-library'' in my ~/.ssh/config file: | Connect to the server. In my case, I have the hostname set as ''parallel-library'' in my <code>~/.ssh/config<.code> file: | ||
<syntaxhighlight lang="bash" line> ssh parallel-library</syntaxhighlight> | <syntaxhighlight lang="bash" line> ssh parallel-library</syntaxhighlight> |
Revision as of 18:00, 2 November 2021
Sometimes, when making changes to the server settings in the calibre-web browser interface, you may get a 502 error. This means that the server isn't responding to HTTP requests. This quick-fix assumes you have SSH access to the machine you are running calibre-web from. If you have local access, even better, you can just restart the server directly.
Connect to the server. In my case, I have the hostname set as parallel-library in my ~/.ssh/config<.code> file:
ssh parallel-library
Activate the python virtual environment
cd parallel_library
source venv/bin/activate
Check to see if nginx is running
systemctl status nginx
Find the process ID (PID) for all Python scripts running:
ps -aux | grep python
For me, this produces:
root 29857 0.3 1.0 297248 83260 ? Sl 15:09 0:07 python cps.py
root 30054 0.0 0.0 5812 888 pts/0 S+ 15:44 0:00 grep python
The process running the script cps.py is the one we want to stop, then restart. Note down the number next to this process, the PID. In this case it is 29857.
Then, kill the process (swap out the PID)
kill -9 29857
Run the python script in the background (you can close the terminal after this)
nohup python cps.py
Refresh the page in your browser (do a hard refresh to clear cache) and see if the page reappears. Do a quick uploading/downloading test to make sure it’s all working ok.