1.下载安装native
Windows下的APR安装和配置比较简单,可以直接下载Tomcat-native的二进制的版本包:

下载之后的目录结构为:

tcnative-1.dll这个库已经包含了APR,openssl的核心引擎,还有tomcat-native的代码,openssl.exe是集成的openssl的命令行工具;
x64位是64位的文件夹。
但是,值得注意的是,如果要想使用这个openssl.exe 进行发证,需要首先手动设置一个openssl.cnf,也可以去openssl的官网上下载一个来,需要先设置一下环境变量:
set OPENSSL_CONF=openssl.cnf

对于上述的下载,对于每一个tomcat可能对应的tomcat-native不同,一个最好的办法是,在tomcat的二进制介质中bin目录中,就有对应的:

解压之后,和上述的下载的一样,只不过版本和当前的tomcat是对应的;

在这一步中,你也可以选择下载源码,然后在VC中进行编译,可能openssl的编译需要安装perl的环境。

2.openssl生成密钥库和证书库

生成服务器端密钥库
D:\software\tomcat8032\bin>openssl.exe genrsa -out rsa-private-key.pem 1024
WARNING: can't open config file: /usr/local/ssl/openssl.cnf
Generating RSA private key, 1024 bit long modulus
.....++++++
...............................++++++
e is 65537 (0x10001)

设置环境变量
D:\software\tomcat8032\bin>set OPENSSL_CONF=openssl.cnf

生成服务端证书库
D:\software\tomcat8032\bin>openssl.exe req -new -x509 -nodes -sha1 -days 365 -key rsa-private-key.pem -out self-signed-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:cn
State or Province Name (full name) [Some-State]:beijing
Locality Name (eg, city) []:haidian
Organization Name (eg, company) [Internet Widgits Pty Ltd]:css
Organizational Unit Name (eg, section) []:guodian
Common Name (e.g. server FQDN or YOUR name) []:xixi
Email Address []:xixi@163.com


3.配置server.xml
     <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" 
               SSLEnabled="true"
               maxThreads="150" 
               scheme="https" 
               secure="true"
               clientAuth="false" 
               sslProtocol="TLSv1" 
               SSLCertificateKeyFile="D:\software\tomcat8032\conf\openssl\rsa-private-key.pem"
               SSLCertificateFile="D:\software\tomcat8032\conf\openssl\self-signed-cert.pem"/>
对于上述的配置,配置APR的protocol需要换成 Http11AprProtocol,其次,SSLCertificateKeyFile指的是openssl的服务器端的密钥库,SSLCertificateFile指的是服务器端的证书库(不带私钥,只有公钥)。
SSLCertificateFile

Name of the file that contains the server certificate. The format is PEM-encoded.

In addition to the certificate, the file can also contain as optional elements DH parameters and/or an EC curve name for ephemeral keys, as generated by openssl dhparam and openssl ecparam, respectively. The output of the respective OpenSSL command can simply be concatenated to the certificate file. This feature needs APR/native version 1.1.34 or later.

SSLCertificateKeyFile

Name of the file that contains the server private key. The format is PEM-encoded. The default value is the value of "SSLCertificateFile" and in this case both certificate and private key have to be in this file (NOT RECOMMENDED).



4.启动

启动之后,发现:


访问之前,需要在浏览器端,将上述的
openssl pkcs12 -export -clcerts -in server/self-signed-cert.pem -inkey server/rsa-private-key.pem -out server/server.p12 导出为P12格式的证书文件,
这样浏览器可以导入

导入进来之后,浏览器可以进行访问:



i.Windows下APR安装过程的更多相关文章

  1. Windows下Redis安装过程

    1.去github下载Redis-x64-2.8.2402.zip压缩包 2.将压缩包解压到你要安装的目录下 3.将redis设置为开机自启动服务 redis-server --service-ins ...

  2. Zookeeper 在Windows下的安装过程及测试

    安装jdk 安装Zookeeper. 在官网http://zookeeper.apache.org/下载zookeeper.我下载的是zookeeper-3.4.6版本. 解压zookeeper-3. ...

  3. windows下jenkins安装过程中的那些坑

    在jenkins官网https://jenkins.io/download/下载2.89.4版本的war包,使用jar -jar jenkins.war命令安装,报端口被占的错误,使用jar -jar ...

  4. windows下git安装过程

    参考廖雪峰博客: https://www.liaoxuefeng.com/wiki/896043488029600/896067074338496 git网站下载程序:   https://git-s ...

  5. redis数据存储--redis在Windows下的安装过程

    一.下载软件 1. 下载Redis windows版本,Redis官网下载地址为:https://redis.io/download: 这里下载的是Windows版本,下载地址为:https://gi ...

  6. 关于Influxdb1.4.2在windows下的安装过程的一些问题的记录

    一.安装与配置: 1. Influxdb在1.3以后版本已经关闭了内置 的8086的web管理功能,需要单独的工具来管理 2.其配置文件默认路径是linux格式,需要修改为本机windows格式 我的 ...

  7. mediawiki在windows下的安装

    mediawiki在windows下的安装 对于刚接触wiki的朋友们来说,配置一个服务器环境,安装并运行mediawiki是一件很麻烦的事情,在这里,我尽量用通俗易懂的语言,介绍mw(mediawi ...

  8. Windows 7 x64环境下JDK8安装过程

    Windows 7 x64环境下JDK8安装过程 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads ...

  9. < python音频库:Windows下pydub安装配置、过程出现的问题及常用API >

    < python音频库:Windows下pydub安装配置.过程出现的问题及常用API > 背景 刚从B站上看过倒放挑战之后也想体验下,心血来潮一个晚上完成了基本的实现.其中倒放与播放部分 ...

随机推荐

  1. svm机器学习算法中文视频讲解

    这个是李政軒Cheng-Hsuan Li的关于机器学习一些算法的中文视频教程:http://www.powercam.cc/chli. 一.KernelMethod(A Chinese Tutoria ...

  2. 物理引擎-Physx的源代码去哪里找

    前几天无意中看到了Physx开源了,就连自己的领导也高兴了一下,让本道士去下载源代码琢磨一下,顺便做几个例子跑起来.结果没成想这个nvidia的github上的源代码被移除了,而且csdn,pudn上 ...

  3. mysql 擎特点

  4. hadoop多硬盘配置注意点

    [一].实验环境 1.1.环境 hadoop 2.6.0 namenode 2个  各增加 2个1T硬盘 datanode   3个  各增加3个1T硬盘 1.2.挂载硬盘 fdisk    分区 ( ...

  5. a

    #region DataTable转Json        /// <summary>        /// 将DataTable中的数据转换为JSON字符串,只返回[{...},{... ...

  6. 类ExampleA继承Exception,类ExampleB继承ExampleA。 有如下代码片断:

    try { throw new ExampleB("b") } catch(ExampleA e){ System.out.println("ExampleA" ...

  7. python:模态编程框

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  8. python查找空格和中文

    前言 图片或者文件夹下,命名不规范,有中文或者有空格.这个脚本批处理查找,并输出到 txt中方便修改,也可以扩展为 直接脚本删除空格等.目前只用在Windows上,mac没有测试,不知道能不能行,有需 ...

  9. asp.net-枚举绑定控件

    1.DropDownList asp.net页面: <asp:DropDownList ID="drpTemplateType" runat="server&quo ...

  10. webstorm增加less开发插件

    原文  http://a317222029201405212739.iteye.com/blog/2174140 引自 http://www.tuicool.com/articles/aeye6rY ...