godaddy
ssl
]
Godaddy买ssl证书,godaddy说买的时候填优惠码可以有35%的折扣,我的优惠码 WOWjiqiyu 据说我可以得到$10的积分,还没试过。 使用我的优惠码购买链接: http://www.godaddy.com/ssl/ssl-certificates.aspx?ics=WOWjiqiyu 不使用直接去: http://www.godaddy.com/ssl/ssl-certificates.aspx
参考资料:
Nginx 配置 SSL 证书 + HTTPS 站点小记 http://zou.lu/nginx-https-ssl-module/
SSL证书请求文件(CSR)生成指南 - Apache SSL / Apache ModSSL http://zou.lu/install-godaddy-ssl-https-on-nginx/
Generating a Certificate Signing Request http://support.godaddy.com/help/article/5343/generating-a-certificate-signing-request
步骤:
[1] 在本地开一个dos窗口cd到opensslbin openssl genrsa -des3 -out .key 2048 Enter pass phrase for .key:密码
openssl req -new -key .key -out .csr Country Name (2 letter code) [AU]:CN(CN就代表中国) State or Province Name (full namne) [Some-State]:Guangdong(填省份) Locality Name (eg, city) []:Shaoguan(填城市名) Organization Name (eg, company) [Internet Widgits Pty Ltd]:XXX.com Organizational Unit Name (eg, section) []:DBA Common Name (e.g. server FQDN or YOUR name) []:这里填写最终认证的网址,如:xxx.com(加不加www都是可以的,加或不加,godaddy都会同时认证www和不带www的。见godaddy的说明 http://support.godaddy.com/help/article/5343/generating-a-certificate-signing-request?pc_split_value=4) Email Address []:admin@xxx.com(最好是以域名为后缀的邮箱,填写其它的不知道行不行,反正我填写了这个,第二天godaddy审核通过了) Please enter the following ‘extra’ attributes to be sent with your certificate request A challenge password []:(留空) An optional company name []:(留空)
[2] 用记事本打开产生的.csr,把里面的内容粘到godaddy的相应表单内,然后等待审核。
[3] godaddy审核通过后,就可以下载证书,下载证书的时候会要求选择类型,我选的是other。 然后就下下来一个压缩包,解压后里面有:一个xxx.com.crt和一个gd_bundle.crt 在命令行把这两个文件合成一个: cat xxx.com.crt gd_bundle.crt > xxx_com_combined.crt
[4] 然后,把证书放到下面的例子中测试(需要两个文件,一个就是xxx_com_combined.crt,一个就是最初生成的那个key)。 编译后运行(需要下载openssl,并且把applink.c编译进来。) 执行的时候会需要输入密码(这里我还没有改,其实openssl是有一个密码回调的,就是不用手动输入)
[5] 在浏览器里面输入:https://www.xxx.com:5555 如果看到hello world就成功了(因为只是测试,服务器运行只接收一个连接,接完就退出了。)。
下面的例子修改自: http://h71000.www7.hp.com/doc/83final/ba554_90007/ch05s04.html
附修改这个例子时遇到的问题: 编译的时候会出现:OPENSSL_Uplink(10115000,08): no OPENSSL_Applink 这是因为缺少applink.c,添加这个文件就可以了,这个文件在openssl的目录里可以找到。
chrome的HTTPS测试成功。 但是用IE出现这个: 948:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:.ssls3_pkt.c:350: 修改 meth = SSLv3_method(); 为 meth = SSLv23_method(); 就好了。
源码在这里: https://gist.github.com/huxingyi/5334045