Wildfly 9.0.2设置https监听器

时间:2016-12-11 09:10:12

标签: https wildfly-9

我一直在为此奋斗2天。我想在我的本地Mac上的Wildfly 9.0.2.Final上设置https监听器。我是野生动物的新手。我已经从我的生产环境复制了我的wildfly设置(domain.xml和host.xml),但是在Prod上我们有负载均衡器来路由到https流量,我不想在我的本地设置负载均衡器。我已经在互联网上查了一下并且做到了这一点: 1.在此链接后生成自签名证书: https://docs.jboss.org/author/pages/viewpage.action?pageId=66322705&_sscc=t 2.在host.xml中添加了一个安全领域:

<security-realm name="SSLRealm">
  <server-identities>
    <ssl>
      <keystore path="foo.keystore" relative-to="jboss.domain.config.dir" alias="foo" keystore-password="secret" key-password="secret" />
    </ssl>
  </server-identities>
</security-realm>
  1. 在domain.xml中我有几个配置文件设置,每个配置文件都有一个子系统。从我的在线搜索中,我了解到我需要在下位子系统中添加一个https-listener。现在,我不清楚在哪个下行子系统中,我添加了https-listener。我仍然将它添加到我的应用程序部署的配置文件中(因为我想在本地只有一个应用程序的https监听器)。我的domain.xml部分位于问题的最后。
  2. 我的应用程序通过http的端口是8580(我已将端口偏移设置为500),即我在URL上访问我的应用程序: http://localhost:8580/myApp 当我去任何一个: https://localhost/https://localhost:8580https://localhost:443https://localhost/myApp 我只是得到“这个网站无法到达.localhost拒绝连接。”响应。 作为wildfly的新手,我无法弄清楚我在哪里犯了错误,也应该是访问HTTPS URL的端口。 如果我需要提供更多信息,请告诉我。 任何帮助将受到高度赞赏。

    <profiles>
                                <profile name="content-profile">
                                       <subsystem.......
                                       <subsystem xmlns="urn:jboss:domain:undertow:2.0">
                                        <buffer-cache name="default"/>
                                        <server name="default-server">
                                            <ajp-listener name="ajp" socket-binding="ajp"/>
                                            <http-listener name="default2" socket-binding="http" redirect-socket="https" proxy-address-forwarding="true" max-post-size="10737418240" max-parameters="5000"/>
                                            <https-listener name="default" socket-binding="https" security-realm="SSLRealm" />
                                            <host name="default-host" alias="localhost">
                                                <location name="/" handler="welcome-content"/>
                                                <filter-ref name="server-header"/>
                                                <filter-ref name="x-powered-by-header"/>
                                            </host>
                                        </server>
                                        <servlet-container name="default">
                                            <jsp-config/>
                                            <websockets/>
                                        </servlet-container>
                                        <handlers>
                                            <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
                                        </handlers>
                                        <filters>
                                            <response-header name="server-header" header-name="Server" header-value="WildFly/9"/>
                                            <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
                                        </filters>
                                    </subsystem>
                              </profile>
                        </profiles>
    

1 个答案:

答案 0 :(得分:0)

好。我只是想出来,所以想到发布答案,以帮助可能面临同样问题的人。 我设置了一切正确(在{1}}下的<ssl>位于host.xml中,<server-identites>位于下位子系统中。我只是不知道访问https连接的端口号。在关注我的domain.xml一段时间之后,我注意到<https-listener>标记,看起来像这样:

<socket-binding-groups>

安全连接的端口号是8443,我已经为我的应用程序设置了500作为端口偏移量,所以当我访问https://localhost:8943/myApp时...瞧!我得到接受证书的提示,接受后,我看到了主页。 :d

相关问题