2011-09-22 84 views
7

我試圖按照本地應用程序的setting up SSL in Tomcat 7的說明操作。我真的不明白我在這裏做什麼,所以請原諒我的方法。我創建了一個密鑰存儲,像這樣:Tomcat中的SSL 7

keytool -genkey -alias tomcat -keyalg RSA 
Enter keystore password: changeit 
Re-enter new password: changeit 
What is your first and last name? 
    [Unknown]: Robert Bram 
What is the name of your organizational unit? 
    [Unknown]: Developers 
What is the name of your organization? 
    [Unknown]: MyBusiness 
What is the name of your City or Locality? 
    [Unknown]: Melbourne 
What is the name of your State or Province? 
    [Unknown]: Victoria 
What is the two-letter country code for this unit? 
    [Unknown]: AU 
Is CN=Robert Bram, OU=Developers, O=MyBusiness, L=Melbourne, ST=Victoria, C=AU correct? 
    [no]: yes 

Enter key password for <tomcat> 
     (RETURN if same as keystore password): 

我加入一個連接器端口,以我的server.xml:

<Connector port="8443" maxThreads="200" 
     scheme="https" secure="true" SSLEnabled="true" 
     keystoreFile="${user.home}/.keystore" keystorePass="changeit" 
     clientAuth="false" sslProtocol="TLS"/> 

我導出的證書:

keytool -export -alias tomcat -file tomcatcertfile.cer 
Enter keystore password: changeit 
Certificate stored in file <tomcatcertfile.cer> 

我重新啓動Tomcat的。我在IE中加載我的應用程序https://localhost:8443/blah/myapp。它顯示證書錯誤。

我點擊地址欄中的「證書錯誤」>點擊查看證書>點擊安裝證書>下一步>勾選將所有證書放入下列存儲區>點擊瀏覽>點擊信任的根證書頒發機構>下一步>完成>是>確定>確定。

現在,當我轉到頁面時,我看到「本網站提供的安全證書是針對不同網站的地址發佈的」。

那麼..我究竟做錯了什麼?

感謝您的任何建議!

羅布 :)

回答

6

,而不用輸入你的名字,輸入服務器的主機名。

+0

謝謝 - 就是這樣。 :) –

+0

我有一個問題..如果我先安裝證書,它永遠不會工作。它只適用於如果我去IE瀏覽器,看到錯誤,然後安裝證書。這是爲什麼? –

+1

我寫了這個:[獲取HTTPS在Tomcat上爲localhost工作](http://robertmarkbramprogrammer.blogspot.com/2011/09/get-https-to-work-for-localhost-on.html)。 –