几天来,我一直在尝试在 aws ec2 上启动一个文档记录不佳的游戏应用程序(帮助朋友),作为一个完整的游戏和 bash-rookie,最终设法启动它;但不像在声明的 playShop.sh 文件中那样监听端口 8080,而是在随机端口 (8081) 上监听,因为 8080 引发了“已在使用”-异常。
playShop.sh(更改了端口):
sudo nohup ./start -Dconfig.file=/home/ec2-user/prod.conf -Dhttp.port=8081 -Dhttp.address=127.0.0.1 &
开始
!/usr/bin/env sh
执行 java $* -cp "
dirname $0
/lib/*" play.core.server.NettyServerdirname $0
到目前为止,一切都很好!但是我现在如何通过网络浏览器访问它?当我调用公共 DNS 时,我会进入一个标准的欢迎页面。我尝试在该端口上设置安全组设置(quicklaunch1-->inbound)并使用负载均衡器-->侦听器,但没有任何帮助。
这似乎是漫长旅程的最后一步,欢迎任何帮助!谢谢。
编辑:这是 nohup.out 在这两个端口上登录的内容:
Play server process ID is 1593
[[37minfo[0m] play - Application started (Prod)
Oops, cannot start the server.
org.jboss.netty.channel.ChannelException: Failed to bind to: /127.0.0.1:8080
at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:298)
at play.core.server.NettyServer.<init>(NettyServer.scala:63)
at play.core.server.NettyServer$.createServer(NettyServer.scala:132)
at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:162)
at play.core.server.NettyServer$$anonfun$main$5.apply(NettyServer.scala:161)
at scala.Option.map(Option.scala:133)
at play.core.server.NettyServer$.main(NettyServer.scala:161)
at play.core.server.NettyServer.main(NettyServer.scala)
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:137)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:77)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.bind(NioServerSocketPipelineSink.java:138)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.handleServerSocket(NioServerSocketPipelineSink.java:90)
at org.jboss.netty.channel.socket.nio.NioServerSocketPipelineSink.eventSunk(NioServerSocketPipelineSink.java:64)
at org.jboss.netty.channel.Channels.bind(Channels.java:569)
at org.jboss.netty.channel.AbstractChannel.bind(AbstractChannel.java:187)
at org.jboss.netty.bootstrap.ServerBootstrap$Binder.channelOpen(ServerBootstrap.java:343)
at org.jboss.netty.channel.Channels.fireChannelOpen(Channels.java:170)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:80)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:158)
at org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory.newChannel(NioServerSocketChannelFactory.java:86)
at org.jboss.netty.bootstrap.ServerBootstrap.bind(ServerBootstrap.java:277)
... 7 more
Play server process ID is 1650
[[37minfo[0m] play - Application started (Prod)
[[37minfo[0m] play - Listening for HTTP on port 8081..
.