#rpm –e –-nodeps openssl
#tar xzvf openssl-0.9.7e.tar.gz
#cd openssl-0.9.7e #./config --prefix=/usr/local/openssl #make #make test #make install
#tar zxvf httpd-2.0.52.tar.gz #cd httpd-2.0.52 #./configure --prefix=PREFIX --enable-ssl --enable-rewrite --enable-so --with-ssl=/usr/local/openssl #make #make install
[root@win ssl]# cp /usr/local/openssl/ssl/misc/CA.sh /usr/local/apache/conf/ssl.crt/CA.sh
[root@win ssl.crt]# ./CA.sh -newca
[root@win ssl.crt]# openssl genrsa -des3 -out server.key 1024
[root@win ssl.crt]# openssl req -new -key server.key -out server.csr
Country Name (2 letter code) [GB]:CN State or Province Name (full name) [Berkshire]:FUJIAN Locality Name (eg, city) [Newbury]:FUZHOU Organization Name (eg, company) [My Company Ltd]:FJJM Organizational Unit Name (eg, section) []:FD Common Name (eg, your name or your server's hostname) []:WIN Email Address []:[email protected] Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:WIN An optional company name []:WING
[root@win ssl.crt]# mv server.csr newreq.pem [root@win ssl.crt]# ./CA.sh -sign这样就生成了server的证书newcert.pem
[root@win ssl.crt]# mv newcert.pem server.crt
[root@win ssl.crt]# openssl genrsa -des3 -out client.key 1024
[root@win ssl.crt]# openssl req -new -key client.key -out client.csr
[root@win ssl.crt]# openssl ca -in client.csr -out client.crt
[root@win ssl.crt]# openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.pfx
#cp demoCA/cacert.pem cacert.pem
#cp cacert.pem ca.crt
#cd /usr/local/apache/conf
指定服务器证书位置 SSLCertificateFile /usr/local/apache/conf/ssl.crt/server.crt 指定服务器证书key位置 SSLCertificateKeyFile /usr/local/apache/conf/ssl.crt/server.key 证书目录 SSLCACertificatePath /usr/local/apache/conf/ssl.crt 根证书位置 SSLCACertificateFile /usr/local/apache/conf/ssl.crt/cacert.pem 开启客户端SSL请求 SSLVerifyClient require SSLVerifyDepth 1
/usr/local/apache/bin/apachectl --startssl会要求输入server.key的密码
from:http://www.chinaunix.net/jh/4/479635.html