如何在0.0.0.0上启动牛仔?

问题描述:

我正在使用Exrm来部署我的Phoenix应用程序。我已经配置我的应用程序绑定到0.0.0.0在我config/prod.exs如何在0.0.0.0上启动牛仔?

config :apiServer, ApiServer.Endpoint, 
    http: [ip: {0, 0, 0, 0}, port: 4000], 
    url: [host: "sitenamehere.co", port: 4000], 
    cache_static_manifest: "priv/static/manifest.json", 
    root: ".", 
    cache_static_manifest: "priv/static/manifest.json", 
    server: true, 
    version: Mix.Project.config[:version] 

然而,当我跑我的版本,我得到:

Running ApiServer.Endpoint with Cowboy using http://localhost:4000

,当它应该是0.0.0.0。帮帮我?

+1

你有没有去查看你的服务器绑定到? – pvg

+0

@pvg我不确定我关注。 :/ –

+0

你知道,运行netstat或者任何你喜欢的工具是检查在4000端口上监听的接口。不管怎么说,绑定到所有东西可能不是一个好主意,但你可以轻松地检查。 – pvg

记录的值在this pull request中被更改。

Phoenix版本1.2.1及更高版本中应该存在哪个版本。你能确认你正在使用哪个版本的凤凰?

在该请求之前,该值始终会在日志中显示localhost,但http://0.0.0.0:4000可以工作。

这下面提交也是历史上有关这个问题: