Amazon EC2错误:收听EACCES 0.0.0.0:80

时间:2018-06-25 09:49:55

标签: node.js http amazon-ec2 vue.js yarnpkg

我已经将HTTP TCP端口80添加到了入站规则,但是仍然出现错误:

#include <initializer_list>
#include <iostream>
#include <list>

struct A
 {
   std::list<int> l;

   template <template <typename...> class Iterable = std::initializer_list,
             typename ... Ts> 
   A (Iterable<int, Ts...> const & it);
 };

template <template <typename...> class Iterable, typename ... Ts>
A::A (Iterable<int, Ts...> const & it) : l{std::cbegin(it), std::cend(it)}
 { }

int main ()
 {
   std::list<int> l {1, 2, 3, 4};
   A a(l);

   for (auto i : a.l)
      std::cout << i << " ";
   std::cout << std::endl;

   A b {{1, 2, 3, 4}};

   for (auto i : b.l)
      std::cout << i << " ";
   std::cout << std::endl;
 }

3 个答案:

答案 0 :(得分:9)

要想在端口80上监听,您可能必须使用sudo运行node.js脚本。

答案 1 :(得分:2)

您不能运行没有root特权的低端口(1024以下)侦听进程。

如上所述,您要么尝试以sudo的身份运行,要么开始使用反向代理(例如nginx),在另一个端口上启动该进程,然后使用反向代理来转发来自端口{ {1}}到您开始该过程的任何端口。

答案 2 :(得分:1)

错误代码EACCES表示您没有适当的权限来在该端口上运行应用程序。在Linux系统上,低于1024的任何端口都需要root访问权限。

相关问题