2016-12-11 58 views
0

我一直在爲此奮鬥了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:Wildfly 9.0.2設置https監聽器

<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> 
  • in domain.xml我有幾個配置文件的設置,並且每個都有一個子系統管道。從我的在線搜索中,我明白我需要在承運人子系統中添加一個https監聽器。現在,我不清楚在哪個子系統中,我添加了https-listener。我仍然將它添加到我的應用程序部署下的配置文件中(因爲我希望https監聽器僅適用於本地的一個應用程序)。我的domain.xml部分在問題的末尾。
  • 端口爲我的應用程序通過HTTP是8580(我已經設置端口偏移爲500),即,我訪問URL我的應用程序: http://localhost:8580/myApp 當我去到任何的: https://localhost/https://localhost:8580https://localhost:443https://localhost/myApp 我剛剛得到「本網站無法訪問。localhost拒絕連接。」響應。 作爲新來的野蠅,我不知道我在哪裏犯了一個錯誤,也應該是訪問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> 
    

    回答

    0

    好的。我只是想通了,所以想到發佈答案來幫助可能面臨同樣問題的人。 我已經安裝了一切正確(下的<server-identites>在託管子系統中的host.xml和<https-listener>)。我只是不知道訪問https連接的端口號。在我的domain.xml一段時間盯着後,我發現<socket-binding-groups>標籤,它看起來是這樣的:

    <socket-binding-groups> 
         <socket-binding-group name="standard-sockets" default-interface="public"> 
          <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/> 
          <socket-binding name="http" port="${jboss.http.port:8080}"/> 
          <socket-binding name="https" port="${jboss.https.port:8443}"/> 
          <socket-binding name="txn-recovery-environment" port="4712"/> 
          <socket-binding name="txn-status-manager" port="4713"/> 
          <outbound-socket-binding name="mail-smtp"> 
           <remote-destination host="localhost" port="25"/> 
          </outbound-socket-binding> 
         </socket-binding-group> 
    .... 
    

    安全連接的端口號是8443,我設置了500端口作爲我的應用程序偏移,所以當我訪問https://localhost:8943/myApp ...瞧!我得到提示接受證書,一旦接受,我會看到主頁。 :D