2015-09-07 40 views
1

我无法使用HTTPS启动并运行我们的系统。使用HTTPS/SSL启动Typesafe Play框架

我已经从我们的通配符证书创建一个密钥文件和放置密钥文件在我们./conf目录:

473 zbeckman:glimpulse-server$ ll conf 
total 72 
drwxr-xr-x 9 zbeckman staff 306 Sep 7 09:26 ./ 
drwxr-xr-x 22 zbeckman staff 748 Sep 7 09:32 ../ 
-rwxr-xr-x 1 zbeckman staff 1213 Sep 7 09:26 application.conf* 
-rw-r--r-- 1 zbeckman staff 1374 Sep 7 08:49 glimpulse.keystore 
-rw-r--r-- 1 zbeckman staff 1439 Aug 9 15:58 logback.xml 
-rwxr-xr-x 1 zbeckman staff 5206 Aug 8 15:36 routes* 
-rw-r--r-- 1 zbeckman staff 575 Apr 29 18:55 ws.conf 
474 zbeckman:glimpulse-server$ 

而且我已经添加了以下我们./conf/application.conf文件,按照在播放Configuring HTTPS页的说明:

play.server.https.keyStore.path = "./conf/glimpulse.keystore" 
play.server.https.keyStore.password = "xxxxxxxxxxxxx" 

最后,我使用-Dhttp.port=disabled -Dhttps.port=9000来尝试启动服务器,但它拒绝启动。

以下是结果。注意输出的最后一行:

472 zbeckman:glimpulse-server$ ./activator start -Dhttp.port=disabled -Dhttps.port=9000 
[info] Loading project definition from /Users/zbeckman/Projects/Glimpulse/Server/project/glimpulse-server/project 
[info] Set current project to Glimpulse (in build file:/Users/zbeckman/Projects/Glimpulse/Server/project/glimpulse-server/) 
[warn] The start command is deprecated, and will be removed in a future version of Play. 
[warn] To run Play in production mode, run 'stage' instead, and then execute the generated start script in target/universal/stage/bin. 
[warn] To test your application using production mode, run 'testProd' instead. 
[info] Wrote /Users/zbeckman/Projects/Glimpulse/Server/project/glimpulse-server/target/scala-2.11/glimpulse_2.11-1.0-SNAPSHOT.pom 

(Starting server. Type Ctrl+D to exit logs, the server will remain in background) 

Must provide either an HTTP or HTTPS port 
473 zbeckman:glimpulse-server$ 

至于密钥存储到哪儿,我使用的Java keytool生成商店的基础上,我们的通配符域证书:

keytool -import -alias tomcat -keystore glimpulse.keystore -trustcacerts -file star_glimpulse_com.crt 

这似乎去只是没问题,密钥库也没有任何错误或警告。

+0

你有没有进展?当涉及到使用HTTPS播放时,我不断点击类似的砖墙。如果任何人有答案,他们似乎没有分享。我曾经在一个实际运行过的演示中运行过,但似乎有一些voodoo与证书的创建方式有关,但我还没有对这个演示/样本启动的项目进行解码。 – Techmag

回答

0

只需添加到您的application.conf:

https { 
    # The HTTPS port of the server. 
    port = 9001 
} 

和您的应用程序将监听端口9001

0

你可以尝试这样运行:

./activator "start -Dhttp.port=disabled -Dhttps.port=9000"

可能需要引号才能确保参数以正确的方式传递给start命令。