111 Connection Refused when trying to connect to Calibre behind reverse proxy

My YunoHost server

Hardware: Old computer
YunoHost version: 3.8.5.7
I have access to my server : Through SSH and webadmin. I also have direct access to the server if needed.
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : yes
If yes, please explain: This is one of two servers running YunoHost on my network. They are both behind a Raspberry Pi serving as an Nginx reverse proxy.

Description of my issue

I have Calibre installed on my server, and have previously been able to use it successfully. When I try to go to mydomain.com/calibre, however, I get a 502 Bad Gateway error, and there’s a corresponding error in /var/log/nginx/mydomain.com-error.log:

2020/08/10 19:31:31 [error] 31431#31431: *287 connect() failed (111: Connection refused) while connecting to upstream, client: 192.168.0.179, server: mydomain.com, request “GET /calibre/ HTTP/1.0”, upstream: “http://127.0.0.1:8083/calibre/”, host: “mydomain.com

This server is behind a Raspberry Pi acting as an Nginx reverse proxy. Here is the mydomain.com.conf file on that reverse proxy:

server {
        server_name mydomain.com;
        location / {
                proxy_pass              https://192.168.0.117;
                proxy_redirect          off;
                proxy_read_timeout      60s;

                proxy_set_header        Host            mydomain.com;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;

                client_max_body_size 50M;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot



}
server {
    if ($host = mydomain.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen 80;
        server_name mydomain.com;
    return 404; # managed by Certbot


}

Whether it’s on the YunoHost server or the reverse proxy, how can I resolve these 111 Connection Refused errors (and, hopefully with them, the 502 Bad Gateway errors)?

Additional info:

By doing some troubleshooting over in a Reddit support thread, it appears that the issue is between YunoHost and Calibre. YunoHost is making requests to Calibre at 127.0.0.1:8083, but Calibre is refusing the connection.

When I SSH into the server and run curl 127.0.0.1:8083, I get a “Connection refused” response:

curl: (7) Failed to connect to 127.0.0.1 port 8083: Connection refused

What’s going on here? How can I troubleshoot further and fix this?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.