如何更改Play框架2.4.1的http端口? [英] How to change the http port for play framework 2.4.1?
问题描述
我来自一个Play 1.2.7应用程序,目前是Play框架2.4.1和Scala的入门.首先,我使用激活器Web ui来管理应用程序,但在那里我无法使该应用程序使用其他http端口.
I come from a play 1.2.7 application and currently getting started with play framework 2.4.1 and scala. For a start I use the activator web ui to manage applications and there I cannot get the application to use a different http port.
我更改了conf/application.conf中的http.port设置,但仍然播放2.4.1尝试绑定到已在使用的端口9000.我尝试的设置是:
I changed the http.port setting in conf/application.conf, but still play 2.4.1 tries to bind to port 9000, which is already in use. The setting I tried is:
http.port=7000
关于如何更改通过激活程序Web ui运行的Play框架2.4.1应用程序的端口的任何建议?
Any suggestion on how to change the port for a play framework 2.4.1 application that is run via the activator web ui?
请注意,如链接的问题中所述,我可以使用
Note that as suggested in the linked question I can use
./activator "run 7000"
在应用程序本身中
使其绑定到端口7000.仍然我的问题是如何通过激活程序Web ui获得相同的行为?
in the application itself to have it bind to port 7000. Still my question is how can I get the same behaviour via the activator web ui?
推荐答案
在项目的build.sbt中添加以下内容,其中<port>
应替换为所需的端口号.
Add the following to build.sbt of your project where <port>
should be replaced with your desired port number.
build.sbt
build.sbt
fork in run := true
javaOptions in run += "-Dhttp.port=<port>"
运行时Activator UI中预期的控制台输出
Expected console output in Activator UI on run
Setting up Play fork run ... (use Ctrl+D to cancel)
--- (Running the application, auto-reloading is enabled) ---
p.a.l.c.ActorSystemProvider - Starting application default Akka system: application
p.c.s.NettyServer - Listening for HTTP on /0:0:0:0:0:0:0:0:<port>
(Server started, use Ctrl+D to stop and go back to the console...)
这篇关于如何更改Play框架2.4.1的http端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!