NGINX를 통해 HTTPS를 HTTP로 리디렉션할 수 없습니다.

NGINX를 통해 HTTPS를 HTTP로 리디렉션할 수 없습니다.

HTTPS에서 HTTP로 리디렉션하는 데 매우 어려움을 겪고 있습니다. 이것은 내가 그것을 알아낼 수 없기 때문에 지난 며칠 동안 나에게 약간의 두통을 안겨주었습니다. |

상황

웹사이트와 VPS 서버가 있습니다. 해당 웹사이트는 별도의 웹호스팅에서 호스팅됩니다. VPS 서버에는 HTTP를 통해서만 연결할 수 있는 API가 있습니다. 예를 들어, 컬 API 호출은 다음과 같습니다.curl http://xxx.xxx.xx.xx:4000/foo/bar

VPS에는 다음 NGINX 구성과 함께 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;
# }

그러나 API를 시도하면 Failed to load resource: net::ERR_CONNECTION_REFUSED 전체 오류가 발생합니다.

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

무엇을 시도해 보셨나요?

listen주로 을(를) 변경 443하거나 추가하기 위해 여러 구성을 시도했습니다 ssl. 제 생각에는 문제가 여기에 있다고 생각합니다(더 많은 문제가 있을 수 있지만 첫 번째 문제는 여기에 있다고 생각합니다). access.log 및 error.log가 비어 있습니다. 이는 연결이 전혀 없고 listen속성이 올바르게 구성되지 않았음을 의미합니다.

나는 SSL 인증서를 제어할 수 있고 인증서, ca_bundle 및 개인 키를 가지고 있습니다.

누가 나를 도와줄 수 있나요?

업데이트

컬 -IL의 전체 출력https://example.com/foo/bar curl: (35) error:0A00010B:SSL routines::wrong version number

VPS에서는 lsof -i다음과 같은 실행 프로세스를 제공합니다.

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)

관련 정보