且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Resin HTTPS 安装指南

更新时间:2022-10-04 20:00:54

Resin HTTPS 安装指南

 
前提
请使用resin  2.x 版本,因为resin 3.x 只有 professional 版本才支持 HTTPS
安装步骤
1. 安装openssl:
   # tar –zxvf openssl-xxx.tar.gz
   # cd openssl-xxx
   # ./config –prefix=/usr/local/openssl shared
   # make && make install
2. 安装resin:
     # mv resin-<version>.tar.gz /usr/local/src
     # tar –zxvf resin-<version>.tar.gz
     # cd resin-<version>
     # ./configure \
        –prefix=/usr/local/resin-<version> \
        –enable-netscape-ssl \
        –with-openssl=/usr/local/openssl
     # make && make install
     # cd /usr/local
     # ln –s resin-<version> resin
3. 建立存放private key  certificate 的目录
  #export RESIN_HOME=/usr/local/resin
  # mkdir $RESIN_HOME/keys
4. 生成private key  certificate
   # export PATH=/usr/local/openssl/bin:$PATH
   # cd $RESIN_HOME/keys
   # openssl genrsa –des3 –out test.key 1024
        请按提示输入private key  passphrase(假设为mykey)
   # openssl req –new –key test.key -x 509 –out test.crt
当提示输入 private key  passprase 的时候,输入mykey;
请按提示输入 country, province, city, organization, distinct name(本机的FQDN) and email address.
如果要使用商业证书,那么可以生成一个证书请求:
#openssl req -new -key test.key -out cert.csr
然后拿着这个文件去数字证书颁发机构(即CA)申请一个数字证书。
5. 修改resin.conf
     <http port='443'>
        <ssl>openssl</ssl>
        <certificate-file>keys/test.crt</certificate-file>
        <certificate-key-file>keys/test.key</certificate-key-file>
        <key-store-password>mykey</key-store-password>
     </http>
6. 删除stderr.logstdout.log, 启动resin
测试:
1. 查看stdderr.log, 确定没有错误提示,
  查看 stdout.log, 确定HTTPS443端口上监听. 
2. #openssl s_client –host <本机的FQDN> -port 443
    如果HTTPS在正常运作我们应该可以看到SSL的协商信息.
3. 在浏览器中使用HTTPS协议访问我们的HTTPS 站点如果HTTPS在正常运作,
    我们该可以看到一个窗口提示我们说我们的HTTPS 站点的 certificate 有问题
  (当然,如果使用的是商业证书,不会提示有问题), 点击”yes”, 就可以看到
  我们的站点了.
 
注:FQDN, 全限定域名,形如 [url]www.cisco.com[/url]


本文转自zkjian517 51CTO博客,原文链接:http://blog.51cto.com/zoukejian/57021