2016-02-06 82 views
1

我有nginx服務器,即將過期的StartSSL免費證書。我想更新它。SSL:錯誤:0B080074:x509證書例程:X509_check_private_key:鍵值不匹配,但模數匹配

openssl req -new -sha256 -nodes -days 365 -newkey rsa:2048 -keyout ssl.key -out ssl.csr 

其中我輸入證書生成所需的信息。我將這個CSR粘貼到網站上,併成功獲得了主域上的域名和2個子域名的簽名證書。

後我加載證書服務器輸出這個錯誤:

feb 05 17:46:19 systemd[1]: Unit nginx.service entered failed state. 
feb 05 17:47:13 nginx[4514]: nginx: [emerg] SSL_CTX_use_PrivateKey_file("/etc/nginx/ssl/nginx.key") failed (SSL: error:0B080074:x509 certificate routines:X509_check_private_key:key values mismatch 
feb 05 17:47:13 nginx[4514]: nginx: configuration file /etc/nginx/nginx.conf test failed 
feb 05 17:47:13 systemd[1]: nginx.service: control process exited, code=exited status=1 
feb 05 17:47:13 systemd[1]: Failed to start A high performance web server and a reverse proxy server. 

我測試這些命令模量:

openssl x509 -noout -modulus -in nginx.crt | openssl md5 
openssl rsa -noout -modulus -in nginx.key | openssl md5 
openssl req -noout -modulus -in ssl.csr | openssl md5 

和它們匹配。

StartSSL提供帶有中間證書的證書包。我發現如果它們的順序不正確,它可能會失敗,所以我嘗試將它們都作爲第一個證書而沒有成功。

編輯:我試圖在nginx 1.9.3的另一臺服務器上鍵和證書,它工作。所以證書是好的,但服務器不是。

+0

您生成了一個新的私鑰。這是安裝到服務器的私鑰嗎? –

+0

是的,安裝了最初生成的私鑰。我想知道當我只在主域中生成CSR時,是否有問題,但是在startssl頁面上,我輸入了三個。 – nou

+0

Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈有關Dev Ops的問題?](http://meta.stackexchange.com/q/134306)。 – jww

回答

1

創建捆綁包時,請檢查證書序列。它應該是按以下順序:

  1. 服務器證書

  2. 中級證書

  3. 根證書

這可能是錯誤背後的原因。

+0

還有[1 - 3 - 2 order](https://itgala.xyz/nginx-ssl-error0b080074x509-certificate-routinesx509-key-values-mismatch/)適用於nginx –

相關問題