Não é possível redirecionar HTTPS para HTTP via NGINX

Não é possível redirecionar HTTPS para HTTP via NGINX

Estou tendo muita dificuldade em redirecionar de HTTPS para HTTP. Isso está me dando uma dor de cabeça nos últimos dias porque não consigo entender :|

situação

Eu tenho um site e um servidor VPS. O site está hospedado em uma hospedagem separada. No servidor VPS, tenho uma API que só pode ser acessada via HTTP. Por exemplo, uma chamada de API curl pode ter esta aparênciacurl http://xxx.xxx.xx.xx:4000/foo/bar

O VPS possui o NGINX instalado com a seguinte configuração NGINX:

server {
    listen <website-domain-ip>:443;
    server_name localhost <website-domain> www.<website-domain>;
    ssl_certificate     /root/certificates/<website-domain>/certificate.crt;
    ssl_certificate_key /root/certificates/<website-domain>/private.key;

    location ~ / {
        proxy_pass http://127.0.0.1:4000;
    }
 }

# server {
#    listen 80;
#    server_name <website-domain> www.<website-domain>;
#    return 301 http://$http_host$request_uri;
# }

No entanto, quando tento a API, recebo Failed to load resource: net::ERR_CONNECTION_REFUSED o erro completo

GET https://xxx.xxx.xx.xxx:4000/foo/bar net::ERR_CONNECTION_REFUSED

O que você tentou?

Eu tentei várias configurações principalmente para alterar listenapenas 443ou adicionar arquivos ssl. Acho que o problema está aqui (provavelmente haverá mais problemas, mas acho que o primeiro problema está aqui). O access.log e o error.log estão vazios, o que significa que não há nenhuma conexão e a listenpropriedade não está configurada corretamente.

Eu tenho controle sobre os certificados SSL e tenho o certificado, ca_bundle e a chave privada.

Quem pode me ajudar?

ATUALIZAR

saída completa de curl -ILhttps://example.com/foo/bar curl: (35) error:0A00010B:SSL routines::wrong version number

No VPS lsof -ifornece os seguintes processos em execução

systemd-n   690 systemd-network   15u  IPv4 853475      0t0  UDP ip185-132-47-xxx.pbiaas.com:bootpc 
systemd-r   692 systemd-resolve   13u  IPv4  24956      0t0  UDP localhost:domain 
systemd-r   692 systemd-resolve   14u  IPv4  24957      0t0  TCP localhost:domain (LISTEN)
sshd        744            root    3u  IPv4  24330      0t0  TCP *:ssh (LISTEN)
sshd        744            root    4u  IPv6  24332      0t0  TCP *:ssh (LISTEN)
postgres    782        postgres    5u  IPv6  31871      0t0  TCP localhost:postgresql (LISTEN)
postgres    782        postgres    6u  IPv4  31872      0t0  TCP localhost:postgresql (LISTEN)
postgres    782        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    788        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    789        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    790        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    791        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    792        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
postgres    793        postgres    8u  IPv6  31877      0t0  UDP localhost:60421->localhost:60421 
nginx     35874            root    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35874            root    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35875        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35875        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35876        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35876        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35877        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35877        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35878        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35878        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35879        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35879        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
nginx     35880        www-data    6u  IPv4 647926      0t0  TCP *:https (LISTEN)
nginx     35880        www-data    7u  IPv4 647927      0t0  TCP *:http (LISTEN)
sshd      47034            root    4u  IPv4 854019      0t0  TCP ip185-132-47-xxx.pbiaas.com:ssh->148-216-099-087.dynamic.<internet-provider>.<country-code>:55102 (ESTABLISHED)
sshd      47257            root    4u  IPv4 853604      0t0  TCP ip185-132-47-xxx.pbiaas.com:ssh->119.96.159.237:54986 (ESTABLISHED)

informação relacionada