【问题标题】:Gunicorn connection error on Amazon ec2Amazon ec2 上的 Gunicorn 连接错误
【发布时间】:2018-02-05 03:00:13
【问题描述】:

您好,当我通过 ssh 连接到我的 amazon ec2 实例(AMI 是 amazon linux)并运行命令 gunicorn routes:app --bind 0.0.0.0:80 时,我收到以下错误消息:

[2018-02-05 02:49:24 +0000] [3076] [INFO] Starting gunicorn 19.7.1
[2018-02-05 02:49:24 +0000] [3076] [ERROR] Retrying in 1 second.
[2018-02-05 02:49:25 +0000] [3076] [ERROR] Retrying in 1 second.
[2018-02-05 02:49:26 +0000] [3076] [ERROR] Retrying in 1 second.
[2018-02-05 02:49:27 +0000] [3076] [ERROR] Retrying in 1 second.
[2018-02-05 02:49:28 +0000] [3076] [ERROR] Retrying in 1 second.
[2018-02-05 02:49:29 +0000] [3076] [ERROR] Can't connect to ('0.0.0.0', 80)

我尝试通过运行sudo netstat -nlp | grep :80 来查看该端口是否被占用,但它没有返回任何内容,这意味着该端口未被使用。

为什么gunicorn不能跑了?

编辑: 我更改了安全组中的入站规则,使其对所有端口开放然后gunicorn hello:app -b :8080。现在它在端口 8080 上运行。我想知道为什么它在默认端口 80 上不起作用

【问题讨论】:

  • 你在运行iptables吗?
  • 我不这么认为。我刚刚将入站流量配置为在安全组下的端口 80 上接受 http
  • 您可以运行 IPv6 堆栈吗?如果是,地址将是::/0 而不是0.0.0.0
  • 它是一个 IPV4 堆栈
  • 我编辑了入站规则,让 ALL TRAFFIC 进入,然后 gunicorn hello:app -b :8080 现在在端口 8080 上工作。我想知道为什么它在 http 端口 80 上不起作用?跨度>

标签: python linux amazon-web-services amazon-ec2 gunicorn


【解决方案1】:

端口 80 需要超级用户权限。建议在 80 端口上使用 nginx 等反向代理,并将 gunicorn 放在 1024 以上的另一个端口上

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-02
    • 2016-11-08
    • 2012-05-29
    • 1970-01-01
    • 2021-01-20
    • 2016-02-12
    • 2018-10-31
    • 1970-01-01
    相关资源
    最近更新 更多