简体   繁体   English

在 amazon linux 的 80 端口上运行 NodeJs 应用程序

[英]Running NodeJs application on port 80 of amazon linux

I am trying to get a NodeJs application to run on a Amazon Linux server using port 80. Currently when I run the app it is defaulting to port 1024. I understand that this is due to the fact that I have to be root to run on port 80 but given I am on a aws linux box I am not able to run that as root.我试图让 NodeJs 应用程序使用端口 80 在 Amazon Linux 服务器上运行。目前,当我运行应用程序时,它默认为端口 1024。我知道这是因为我必须是 root 才能运行端口 80 但鉴于我在 aws linux 机器上,我无法以 root 身份运行它。 I have been digging for awhile but I am coming up short on what I need to adjust to get this to run properly.我已经挖掘了一段时间,但我不知道需要调整什么才能使其正常运行。

sudo bash will allow you to connect as root on your EC2 Amazon Linux instance. sudo bash将允许您以root身份连接到您的 EC2 Amazon Linux 实例。 I would question why do you want to run NodeJS on port 80, the best practice would have a load balancer in front of your instance to accept HTTPS calls and relay to whatever port nodejs will run on your instance, in a private subnet.我会问你why要在端口 80 上运行 NodeJS,最佳实践是在你的实例前面有一个负载均衡器来接受 HTTPS 调用并中继到 nodejs 将在你的实例上运行的任何端口,在私有子网中。

I would suggest to read this doc to learn how to do this : https://aws.amazon.com/getting-started/projects/deploy-nodejs-web-app/我建议阅读此文档以了解如何执行此操作: https : //aws.amazon.com/getting-started/projects/deploy-nodejs-web-app/

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

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