2017-10-07 100 views
-1

在發佈此問題之前,我搜索了很多搜索引擎,但沒有一個解決方案適用於我。我想在8443上啓動我的tomcat(Tomcat支持SSL或https)無法在SSL上啓動tomcat

我創建密鑰庫

C:\>keytool -genkey -alias mkyong -keyalg RSA -keystore c:\mkyongkeystore 
Enter keystore password: 
Re-enter new password: 
What is your first and last name? 
    [Unknown]: Rahul Rode 
What is the name of your organizational unit? 
    [Unknown]: XY 
What is the name of your organization? 
    [Unknown]: XY 
What is the name of your City or Locality? 
    [Unknown]: Hyderabad 
What is the name of your State or Province? 
    [Unknown]: Telangana 
What is the two-letter country code for this unit? 
    [Unknown]: IN 
Is CN=Rahul Rode, OU=XY, O=XY, L=Hyderabad, ST=Telangana, C=IN correct? 
    [no]: y 

Enter key password for <mkyong> 
     (RETURN if same as keystore password): 
Re-enter new password: 

和我做的雄貓server.xml文件中的變化

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/> 

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" 
     maxThreads="150" scheme="https" secure="true" 
     clientAuth="false" sslProtocol="TLS" 
    keystoreFile="c:\mkyongkeystore" 
    keystorePass="changeit" /> 

<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/> 

這是我的局域網設置:

enter image description here

,我也關掉我的防火牆設置

enter image description here

並不會錯誤是:

enter image description here

+1

您是否在更改server.xml後重新啓動了tomcat?日誌文件中是否有錯誤信息? –

+0

另外使用TaskMgr或相當於確保Tomcat實際上正在運行,並且'netstat -ano'(或'-anb'提升,或從曾經是sysinternals的TCPView)確保它實際上正在偵聽。一旦你解決了你將在cert中得到錯誤的錯誤名稱的錯誤;字段'keytool'調用'名字和姓'實際上是CommonName,對於SSL/TLS服務器(儘管不是其他X.509應用程序),它必須與URL中的主機名匹配,在您的情況'localhost'中,除非設置了SubjectAltName你沒有。 –

+0

@Denis Lukenich - 是的,我做了,不知道什麼停止在8443上運行。 – Prateek

回答

-1

可以有多個原因無法訪問HTTPS。爲此請記住一些要點: 1:tomcat無法讀取您生成的密鑰庫文件。給它一切權限。 2:端口8443應處於打開狀態。