
我很難從 HTTPS 重新導向到 HTTP。這讓我最近幾天有些頭痛,因為我無法弄清楚:|
情況
我有一個網站和一個 VPS 伺服器。該網站託管在單獨的網站託管上。在 VPS 伺服器上,我有一個只能透過 HTTP 存取的 API。例如,curl 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
將.我認為問題就在這裡(可能會有更多問題,但我認為第一個問題就在這裡)。 access.log 和 error.log 為空,這表示沒有任何連接且屬性配置不正確。443
ssl
listen
我確實可以控制 ssl 證書,並且擁有 cert、ca_bundle 和私鑰。
誰能幫幫我?
更新
完整輸出curl -ILhttps://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)