java 如何在wildfly 8.2.0服务器中配置ssl?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29138478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to configure ssl in wildfly 8.2.0 server?
提问by subhakar patnala
I want secure connection for my web application. So, i want to configure ssl for my wildfly 8.2.0 server. I have created and stored .keystore file in standalone/configuration folder.
我想为我的 Web 应用程序提供安全连接。所以,我想为我的 wildfly 8.2.0 服务器配置 ssl。我已经在独立/配置文件夹中创建并存储了 .keystore 文件。
$ keytool -genkey -alias foo -keyalg RSA -keystore foo.keystore -validity 10950
Enter keystore password: secret
Have to add :
必须添加:
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="443" />
<connector name="https" scheme="https" protocol="HTTP/1.1" socket-binding="https" enable-lookups="false" secure="true">
<ssl name="foo-ssl" password="secret" protocol="TLSv1" key-alias="foo" certificate-key-file="../standalone/configuration/foo.keystore" />
</connector>
in standalone.xml file, but there is tag :
在 standalone.xml 文件中,但有标签:
<subsystem xmlns="urn:jboss:domain:remoting:2.0">
<endpoint worker="default"/>
<http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
</subsystem>
When i am replacing this with above specified tags getting errors:
当我用上面指定的标签替换它时出现错误:
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[288,106]
Message: Unexpected element '{urn:jboss:domain:web:1.1}subsystem'
回答by subhakar patnala
I have configured ssl for wildfly 8.2.0.
我已经为wildfly 8.2.0 配置了ssl。
step1: Creating keystore
步骤 1:创建密钥库
cd $WILDFLY_HOME/standalone/configuration
keytool -genkey -alias localhost -keyalg RSA -keystore keystore.jks -keysize 4096
step2: Editing configuration/standalone.xml
step2:编辑配置/standalone.xml
<management>
<security-realms>
**<security-realm name="SslRealm">
<server-identities>
<ssl>
<keystore path="keystore.jks" relative-to="jboss.server.config.dir" keystore-password="changeme"/>
</ssl>
</server-identities>
</security-realm>**
</security-realms>
step3: Adding listener for https by editing standalone.xml
步骤 3:通过编辑 standalone.xml 为 https 添加侦听器
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
**<https-listener name="default-ssl" socket-binding="https" security-realm="SslRealm"/>**
Now ssl is configured and my website is secured.
现在 ssl 已配置,我的网站已安全。