生成key
openssl genrsa -out ssl.key 2048
生成证书请求
openssl req -new -key ssl.key -out ssl.csr
自签名生成证书
openssl x509 -req -in sign.csr -extensions v3_ca -signkey sign.key -out sign.crt
具体参考 http://www.cnblogs.com/kyrios/p/tls-and-certificates.html