win7(64位)+apache(集成环境) 开启openssl

1、下载并安装ActivePerl
网址: http://www.activestate.com/activeperl/
ActivePerl-5.20.2.2002-MSWin32-x64-299195.msi
下载地址:http://downloads.activestate.com/ActivePerl/releases/5.20.2.2002/ActivePerl-5.20.2.2002-MSWin32-x64-299195.msi

2、下载并解压openssl
网址 http://www.openssl.org/
文件:openssl-1.0.0s.tar.gz (PGP sign) (SHA1)
下载地址:http://www.openssl.org/source/openssl-1.0.0s.tar.gz
下载后解压到指定目录,例如C:\OpenSSL

3、下载并安装Visual Studio 2015 community
https://www.visualstudio.com/downloads/download-visual-studio-vs
ISO格式太大,可以不选择这个格式,安装的时候最好选择自定义安装,不需要安装全部,只需要编译器就行
安装后选择安装目录下的:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat

4、运行VS2015 x64 本机工具命令提示符

点击Visual Studio 2015 -> Visual Studio Tools -> Windows Desktop Command Prompts ->VS2015 x64 本机工具命令提示符,并在命令行中转到OpenSSL解压的目录

5、安装

根据OPENSSL安装说明文件INSTALL.W64说明在命令行输入以下命令

 > perl Configure VC-WIN64A

 > ms\do_win64a

 > nmake -f ms\ntdll.mak

 > cd out32dll

 > ..\ms\test

6、apache中启用ssl的相关配置
进入目录apache/bin的目录
1):生成密钥
命令:openssl genrsa 1024 > server.key

2): 生成证书请求文件
openssl req -config D:\Apache24\conf\openssl.cnf -new -key server.key > server.csr

下面的问题回答可以根据情况任意填写
Country Name (2 letter code) [AU]:China
string is too long, it needs to be less than  2 bytes long
Country Name (2 letter code) [AU]:ca
State or Province Name (full name) [Some-State]:bj
Locality Name (eg, city) []:beijing
Organization Name (eg, company) [Internet Widgits Pty Ltd]:haha
Organizational Unit Name (eg, section) []:haha
Common Name (e.g. server FQDN or YOUR name) []:test.example.com.cn
Email Address []:11111@qq.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:1111
An optional company name []:haha

步骤3: 生成证书
openssl req -config D:\Apache24\conf\openssl.cnf -x509 -days 365 -key server.key -in server.csr > server.crt

openssl req -config D:\wamp\bin\apache\apache2.4.9\conf\openssl.cnf -x509 -days 365 -key server.key -in server.csr > server.crt
把得到的server.key和server.crt文件拷贝到apache的对应目录 conf/

步骤4: 配置apache
修改httpd-ssl.conf文件
注意在此文件中配置证书和密钥
SSLCertificateFile /apache/conf/server.crt
SSLCertificateKeyFile /apache/conf/server.key
虚拟机设置
NameVirtualHost *:443   (此句根据情况添加,有的版本不需要)
<VirtualHost *:443>
…………
</VirtualHost>

步骤5: 修改httpd.conf文件

1)打开ssl模块
LoadModule ssl_module /opt/taobao/install/httpd/modules/mod_ssl.so

2)引入ssl配置文件
Include conf/extra/httpd-ssl.conf

3)修改httpd-ssl.conf文件中的
DocumentRoot
ServerName

4)如果你配置的虚拟机,注意一下端口的访问接受情况
NameVirtualHost *:80
<VirtualHost *:80>
…………
</VirtualHost>

5)启用和socache相关的所有配置

6)重新启动apache
用https方式访问,查看是否生效(添加例外)


注:如果无法启动报错,请在命令行执行下面的语句:
##检查启动报错的问题:apache2.4是服务名称
#cd  apache安装目录/bin
#httpd.exe -w -n "apache2.4" -k start

根据报错信息进行修改
(如果需要CA证书)

1、在生成server.key和server.csr之后
步骤1:使用OPENSSL生成CA私钥

C:\Program Files\Apache Software Foundation\Apache2.2\bin>openssl genrsa -out ca.key 1024

多出CA.key文件

步骤2:利用CA的私钥产生CA的自签署证书

C:\Program Files\Apache Software Foundation\Apache2.2\bin>openssl req -new -x509 -days 365 -key ca.key -out ca.crt -config ..\conf\openssl.cnf

步骤3:在bin目录下新建demoCA目录,在demoCA下新建index.txt,newcerts,serial 目录结构如下

demoCA

|--index.txt(文本,内容为空)

|--newcerts(文件夹)

|--serial(文本,内容为 01)

步骤4:准备为网站服务器签署证书

C:\Program Files\Apache Software Foundation\Apache2.2\bin>openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key -config ..\conf\openssl.cnf

生成 server.crt文件

步骤5:将 server.crt server.key复制到 conf文件夹下
其他步骤见上


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Win64静态编译过的OpenSSL 1.0.2是针对Windows 64位操作系统进行的编译,并且以静态链接库的方式提供给用户使用的版本。 OpenSSL是一个开源的软件库,提供了一系列的加密和网络通信功能。通过编译OpenSSL,可以使其在Windows 64位操作系统上运行,并将其作为静态链接库进行使用。 静态编译的意思是将OpenSSL中的函数和代码编译进最终的应用程序中,而不是在运行时候动态链接。这样做的好处是在使用时不再需要依赖外部的动态链接库文件,而是直接在应用程序中调用OpenSSL的相关函数。这样可以更方便地进行应用程序的开发、部署和发布,减少了外部依赖的麻烦。 OpenSSL 1.0.2是一个较旧的版本,但是仍然被一些程序和系统所使用。通过静态编译,用户可以在Windows 64位操作系统上使用OpenSSL 1.0.2,而不必担心与其他版本或平台的兼容性问题。 通过使用Win64静态编译过的OpenSSL 1.0.2,用户可以在开发和部署应用程序时,使用OpenSSL提供的加密和网络通信功能,保障数据的安全传输和处理。静态编译的方式使得使用OpenSSL更加方便,避免了外部依赖的问题。同时,该版本适用于Windows 64位操作系统,满足了这一平台的需求。 总之,Win64静态编译过的OpenSSL 1.0.2是一个针对Windows 64位操作系统进行的编译,并以静态链接库的形式提供给用户使用的版本,可以方便地在开发、部署和发布应用程序时使用OpenSSL的加密和网络通信功能,保障数据的安全性。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值