
Ich habe große Schwierigkeiten, eine Umleitung von HTTPS auf HTTP einzurichten. Das bereitet mir seit einigen Tagen Kopfschmerzen, weil ich es nicht herausfinden kann :|
Situation
Ich habe eine Website und einen VPS-Server. Die Website wird auf einem separaten Webhosting gehostet. Auf dem VPS-Server habe ich eine API, die nur über HTTP erreichbar ist. Ein Curl-API-Aufruf kann beispielsweise so aussehencurl http://xxx.xxx.xx.xx:4000/foo/bar
Auf dem VPS ist NGINX mit der folgenden NGINX-Konfiguration installiert:
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;
# }
Wenn ich jedoch die API versuche, erhalte ich Failed to load resource: net::ERR_CONNECTION_REFUSED
den vollständigen Fehler
GET https://xxx.xxx.xx.xxx:4000/foo/bar net::ERR_CONNECTION_REFUSED
Was haben Sie versucht?
Ich habe mehrere Konfigurationen ausprobiert, hauptsächlich um listen
nur das zu ändern 443
oder hinzuzufügen ssl
. Ich denke, hier liegt das Problem (es wird wahrscheinlich noch mehr Probleme geben, aber ich denke, das erste Problem liegt hier). Die access.log- und error.log-Dateien sind leer, was bedeuten sollte, dass überhaupt keine Verbindung besteht und die listen
Eigenschaft nicht richtig konfiguriert ist.
Ich habe Kontrolle über die SSL-Zertifikate und ich besitze das Zertifikat, das CA_Bundle und den privaten Schlüssel.
Wer kann mir weiterhelfen?
AKTUALISIEREN
vollständige Ausgabe von curl -ILhttps://example.com/foo/bar
curl: (35) error:0A00010B:SSL routines::wrong version number
Auf dem VPS lsof -i
laufen folgende Prozesse
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)