当前位置: 代码迷 >> .NET Framework >> PlayFramework 1.2.3 中 配备https
  详细解决方案

PlayFramework 1.2.3 中 配备https

热度:323   发布时间:2016-05-02 00:26:56.0
PlayFramework 1.2.3 中 配置https

http://www.playframework.org/documentation/1.1.1/releasenotes-1.1#https

HTTPS support

The built-in server now supports the HTTPS protocol. You can of course use it in production if you want. It supports certificate management, either via the classical Java?keystore?or simple?cert?and?key?files. To start an HTTPS connector for your application, just declare the?https.port?configuration property in your?application.conf?file:

http.port=9000https.port=9443

You need to put your certificates in the?conf?directory. Play supports X509 certificates and keystore certificates. The X509 certificates must be named as follow:
host.cert?for the certificate and?host.key?for the key. If you are using keystore, then, by default it should be named?certificate.jks.

If you are using X509 certificates, then the following parameters can be configured though your?application.conf:

# X509 certificatescertificate.key.file=conf/host.keycertificate.file=conf/host.cert# In case your key file is password protectedcertificate.password=secrettrustmanager.algorithm=JKS

In case your are using keystore:

keystore.algorithm=JKSkeystore.password=secretkeystore.file=conf/certificate.jks

Note that the values above are the default values.

You can generate self signed certificates using?openssl:

openssl genrsa 1024 > host.keyopenssl req -new -x509 -nodes -sha1 -days 365 -key host.key > host.cert

If you are using the java keystore mechanism, then the following properties can be configured in your?application.conf:

# Keystore ssl.KeyManagerFactory.algorithm=SunX509trustmanager.algorithm=JKSkeystore.password=secretkeystore.file=certificate.jks

The values above are the default values.

  相关解决方案