简体   繁体   English

向服务器 IP 发出请求时出现 ERR_SSL_PROTOCOL_ERROR

[英]ERR_SSL_PROTOCOL_ERROR when making request to server IP

I got a nodeJS express API /w enginx up and running on an ubuntu server.我在 ubuntu 服务器上启动并运行了一个 nodeJS express API /w enginx。 I've set up everything but when I try to access the API ( https://167.xx.xx.xx:80/get-all-products ) directly or through my client I get this error:我已经设置了所有内容,但是当我尝试直接或通过我的客户端访问 API ( https://167.xx.xx.xx:80/get-all-products ) 时,我收到此错误:

ERR_SSL_PROTOCOL_ERROR

I've did some searching and I found out that this could be because my server does not have a valid ssl certificate but for a ssl certificate I would need to have a domain / be the owner of the ip adress which I guess i'm not as the server is hosted by another company.我做了一些搜索,发现这可能是因为我的服务器没有有效的 ssl 证书,但对于 ssl 证书,我需要有一个域 / 是我想我的 ip 地址的所有者不是因为服务器由另一家公司托管。

How can I fix this error without having to buy a domain for my server?如何在无需为我的服务器购买域的情况下修复此错误?

https://167.xx.xx.xx:80/... ... https://167.xx.xx.xx:80/... ……
I've did some searching and I found out that this could be because my server does not have a valid ssl certificate我做了一些搜索,发现这可能是因为我的服务器没有有效的 ssl 证书

This isn't the case here yet.这里还不是这种情况。 The problem instead is that you are simply trying to switch from http:// on port 80 to https:// on port 80 without having the server setup for HTTPS.相反,问题是您只是尝试从端口 80 上的http://切换到端口 80 上的https:// ,而没有为 HTTPS 设置服务器。 Thus the client will try to speak HTTPS while the server only understands HTTP - and this causes the failure you see.因此,客户端将尝试使用 HTTPS,而服务器只理解 HTTP——这会导致您看到的失败。

To be able to use https:// in the URL you need to setup the server for this and the configuration must use a certificate which matches the URL (domain or IP) - no way around this.为了能够在 URL 中使用https:// ,您需要为此设置服务器,并且配置必须使用与 URL(域或 IP)匹配的证书 - 没有办法解决这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM