1

所以我对设置服务器有点陌生。而且我整晚都在为各种 sql 问题苦苦挣扎。我认为我和成功运行的游戏应用程序之间的唯一障碍是:错误

Starting process with command `target/start -Dhttp.port=80 `
2012-04-04T05:58:52+00:00 app[web.1]: Play server process ID is 1
2012-04-04T05:58:53+00:00 app[web.1]: [info] play - database [default] connected at jdbc:mysql://us-cdbr-east.cleardb.com/heroku_cd914b667dae168
2012-04-04T05:58:56+00:00 app[web.1]: [info] play - Application started (Prod)
2012-04-04T05:58:56+00:00 app[web.1]: Oops, cannot start the server.
2012-04-04T05:58:56+00:00 app[web.1]: org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
... more errors

有没有人发现任何问题?我需要任何 java 选项参数吗?

我尝试在 中指定用户端口,但Procfile收到了不同的错误消息:

2012-04-04T07:01:36+00:00 heroku[web.1]: Starting process with command `target/start -Dhttp.port=2000`
2012-04-04T07:01:37+00:00 app[web.1]: Play server process ID is 1
2012-04-04T07:01:40+00:00 app[web.1]: [info] play - database [default] connected at jdbc:mysql://us-cdbr-east.cleardb.com/heroku_cd914b667dae168
2012-04-04T07:01:45+00:00 app[web.1]: [info] play - Application started (Prod)
2012-04-04T07:01:45+00:00 app[web.1]: [info] play - Listening for HTTP on port 2000...
2012-04-04T07:01:46+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 2000, should be 47248 (see environment variable PORT)
2012-04-04T07:01:46+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-04-04T07:01:47+00:00 heroku[web.1]: Process exited with status 137
2012-04-04T07:01:47+00:00 heroku[web.1]: State changed from starting to crashed

我不知道发生了什么。如何更改此环境变量?这个heroku流程模型让我很困惑。

4

1 回答 1

5

我认为问题在于您不允许 Heroku 指定端口。谷歌搜索你的错误我发现:https ://devcenter.heroku.com/articles/error-codes#r11__bad_bind

所以不要这样做:

网络:目标/开始 -Dhttp.port=80

做这个

网络:目标/开始 -Dhttp.port=$PORT

James 有一篇关于在此处部署更高级的 Play 2.0 应用程序的文章。

于 2012-04-04T09:40:18.847 回答