它不適用於您正在採取的方法。您錯誤地將2.x分支的發行說明與2.x分支相混淆。
in 1.x分支,這是可能的。發行說明已足夠,並且他們爲我工作。
對於2.1+分支,請參考@克里斯蒂娜的評論。 2.1中增加了支持,討論線索提供了詳細信息。
引用詹姆斯羅珀的響應
在開發者模式,這是非常簡單,只需:
JAVA_OPTS = -Dhttps.port = 9443遊戲運行
比賽將產生一個私鑰和自簽名證書,這顯然是您的瀏覽器會遇到一個大的紅色警告。它將 重複使用爲Play的每個後續運行 生成自簽名證書,因此您應該只能得到一次瀏覽器錯誤。很顯然 這個自簽名證書可能不是你想要在 生產。另外需要注意的是,自簽名的 證書生成將僅適用於使用安全庫(例如Oracle和OpenJDK,但最顯着的不是IBM J9)的JVM。在不使用這些JVM的情況下,當您嘗試生成證書時,您會得到一個 NoClassDefFoundError。
在prod中(並且此配置也適用於dev),您可以使用與您通過系統 屬性一般在Java中配置SSL相同的方式對其進行多種配置 。這裏有一個總結:
https.port - 應使用
HTTPS端口。的keyStore - 以 包含私鑰和證書的密鑰庫的路徑,如果沒有 提供生成一個密鑰對你
https.keyStoreType - 關鍵 存儲類型,默認爲「JKS」
https.keyStorePassword - 密碼, 默認爲 「」
https.keyStoreAlgorithm - 密鑰存儲算法, 個默認爲平臺的默認算法
https.trustStore - 這 功能尚未完全實施,目前它總是使用 的JDK的信任存儲用於驗證客戶端證書(您 當然可以配置的你自己),你是否爲提供一個值這個 與否,除非你指定「noCA」,在這種情況下,它會使用一個信任 商店,相信所有的證書,沒有確認或驗證, 這是有用的,如果使用webid客戶端證書驗證。
2.0分支,你必須把另一臺服務器盈發揮即任阿帕奇/ nginx的/其他監聽的HTTPS和轉發在HTTP播放請求。
說明設置一個前端服務器可在http://www.playframework.org/documentation/2.0.1/HTTPServer
這樣跑一個端口上播放服務器。將apache轉發請求從domain.com發送到127.0.0.1:9443。
樣品的Apache配置
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName example.com
ServerAlias *.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined
ProxyPreserveHost On
# ProxyPass /excluded !
ProxyPass/http://127.0.0.1:9000/
ProxyPassReverse/http://127.0.0.1:9000/
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# A self-signed (snakeoil) certificate can be created by installing
# the ssl-cert package. See
# /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
# If both key and certificate are stored in the same file, only the
# SSLCertificateFile directive is needed.
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
希望它能幫助。
什麼不行?請提供更多信息,如堆棧跟蹤和配置文件。此外,您已閱讀Play 1的文檔,並且正在嘗試爲Play 2配置SSL,因此您的閱讀錯誤文檔 –
@ Li-o我已更新了更多信息。你有關於https配置的Play2更新文檔嗎?你能跟我分享一下嗎?多謝〜 – Chris