如何使用 OpenSSL 建立開發測試用途的自簽憑證
透過 OpenSSL 命令產生出自簽憑證與相對應的私密金鑰
openssl req -x509 -new -nodes -sha256 -utf8 -days 3650 -newkey rsa:2048 -keyout server.key -out server.crt -config ssl.conf
透過 OpenSSL 命令產生 PKCS#12 憑證檔案 (*.pfx 或 *.p12)
openssl pkcs12 -export -in server.crt -inkey server.key -out server.pfx
server.key (私密金鑰) (使用 PEM 格式) (無密碼保護) server.crt (憑證檔案) (使用 PEM 格式) server.pfx (PFX 檔案) (使用 PKCS#12 格式)
Windows Server中所使用的pfx格式证书转成nginx可用的证书
openssl pkcs12 -in ./server.pfx -clcerts -nokeys -out ./nginx.crt
openssl pkcs12 -in ./server.pfx -nocerts -nodes -out ./nginx.key