生产为签署的server.csr
继续在bin目录下执行命令:
openssl req -new -config ../conf/openssl.cnf -key server.key >server.csr
(如果不加-config ../conf/openssl.cnf参数的话,常会报Unable to load config info from /usr/local/ssl/openssl.cnf)
然后就会要求输入一系列的参数:
Country Name (2 letter code) [AU]:CN ISO 国家代码(只支持两位字符)
State or Province Name (full name) [Some-State]:ZJ 所在省份
Locality Name (eg, city) []:HZ 所在城市 Organization Name (eg, company): 公司名称
Organizational Unit Name (eg, section) []: 组织名称
Common Name (eg, YOUR name) []: 申请证书的域名
Email Address []:admin@admin.com 管理员邮箱
Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: 交换密钥
An optional company name []:
注: Common Name 必须和 httpd.conf 中 server name 必须一致, 否则 apache 不能启动(启动 apache 时错误提示为: server RSA certificate CommonName (CN) `Kedou' does NOT match server name!? )
签署服务器证书文件 server.crt
继续在 bin 目录,执行命令行 命令:
openssl req -x509 -days 4000 -config ../conf/openssl.cnf -key server.key -in server.csr >server.crt
说明:这是用步骤 1,2 的的密钥和证书请求生成证书 server.crt,-days 参数 指明证书有效期,单位为天,x509 表示生成的为 X.509 证书。
在bin 目录下,找到
server.crt
server.csr
server.key
三个文件,将此三个文件复制到Apache的conf目录下。