简体   繁体   English

尝试使用 Node.js 访问 AWS EC2 上的端口 3000 时出现 ERR_SSL_PROTOCOL

[英]ERR_SSL_PROTOCOL when trying to access port 3000 on AWS EC2 with Node.js

I'm following this tutorial where they are setting up a express server and when you go to the DNS you see your response (in this case HEY,), this is the link to the tutorial https://hackernoon.com/tutorial-creating-and-managing-a-node-js-server-on-aws-part-1-d67367ac5171我正在关注本教程,他们正在设置快速服务器,当您将 go 转到 DNS 时,您会看到您的响应(在这种情况下,嘿,),这是教程Z5E056C500A1C4B6A7110B50A1C4B6A7110B50A80D807ern的链接创建和管理-a-node-js-server-on-aws-part-1-d67367ac5171

But when I do it gives me ERR_SSL_PROTOCOL, but the tutorial doesn't even mention anything about SSL and gets it to work.但是当我这样做时,它给了我 ERR_SSL_PROTOCOL,但本教程甚至没有提到任何关于 SSL 的内容并让它工作。

This is my code这是我的代码

const express = require('express')
const app = express()
app.get('/', (req, res) => {
  res.send('HEY!')
})
app.listen(3000, () => console.log('Server running on port 3000'))

This is my security group (outbound rules is set to all traffic)这是我的安全组(出站规则设置为所有流量) 在此处输入图像描述

Your HTTP client/browser likely tried to establish an HTTP S /SSL connection and not an unencrypted HTTP connection to your server.您的 HTTP 客户端/浏览器可能试图建立 HTTP S /SSL 连接,而不是与您的服务器的未加密 HTTP 连接。

Make sure that you do not use https://... when accessing the HTTP endpoint from your client/browser, but use http://... .从客户端/浏览器访问 HTTP 端点时,请确保不要使用https://... ,而是使用http://... If you use a modern browser for this (Google Chrome for example), you likely need to go into the address bar and manually specify http:// as the URL scheme.如果您为此使用现代浏览器(例如 Google Chrome),您可能需要在地址栏中输入 go 并手动指定http://作为 URL 方案。

You can also simply test via any other HTTP client, like cURL, wget, Postman, etc.您也可以通过任何其他 HTTP 客户端进行简单测试,例如 cURL、wget、Postman 等。

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

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