tft每日頭條

 > 生活

 > nginxssl配置詳解

nginxssl配置詳解

生活 更新时间:2024-07-23 13:04:32
一、概述:

客戶提交一個證書給我,讓幫忙把網站域名都改為HTTPS,但是修改配置完成後,确出現如下錯誤。

[root@localhost ssl]# /usr/local/nginx/sbin/nginx -t nginx: [emerg] PEM_read_bio_X509_AUX("/usr/local/nginx/conf/ssl/server.pem") failed (SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode) nginx: configuration FILE /usr/local/nginx/conf/nginx.conf test failed

錯誤關鍵" error:0906D064:PEM routines:PEM_read_bio:bad base64 decode"

nginxssl配置詳解(ssl證書錯誤處理方法)1

二、故障原因:

經過對關鍵字的排查,SSL證書公鑰字符串每隔64個字符需要加一個換行,負責會提示 "error:0906D064:PEM routines:PEM_read_bio:bad base64 decode"

三、解決方法:

出現上述問題的原因,主要是由于客戶提交給我的證書不是文件,直接用微信複制給我的内容,現在一般阿裡雲申請的證書自動生成的文件,直接使用文件就會避免出現這樣的錯誤。

好了,出現錯誤還是要解決的。

首先,想辦法把證書内容轉換為每隔64個字符,加一個換行。

1、可以使用如下命令

[root@dataX ~]# fold --help Usage: fold [OPTION]... [FILE]... Wrap input lines in each FILE (standard input by default), writing to standard output. Mandatory arguments to long options are mandatory for short options too. -b, --bytes count bytes rather than columns -c, --characters count characters rather than columns -s, --spaces break at spaces -w, --width=WIDTH use WIDTH columns instead of 80 --help display this help and exit --version output version information and exit

2、執行語句如下

[root@localhost ssl]# /usr/local/nginx/sbin/nginx -t nginx: [emerg] PEM_read_bio_X509_AUX(“/usr/local/nginx/conf/ssl/server.pem”) failed (SSL: error:0906D064:PEM routines:PEM_read_bio:bad base64 decode) nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed [root@localhost ssl]# fold -w 64 server.pem > server.pem1 [root@localhost ssl]# \cp -rf server.pem1 server.pem [root@localhost ssl]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@localhost ssl]# /usr/local/nginx/sbin/nginx -s reload

核心命令:fold -w 64 文件 >新文件。

如果上述文章對你有幫助,歡迎轉發 關注哦。

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关生活资讯推荐

热门生活资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved