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. js基础练习二之简易日历

    今天学到了js基础教程3,昨天的课后练习还没来的及做,这个是类似简易日历的小案例,视频还没听完,今晚继续...... 先看效果图: 其实做过前面的Tab选项卡,这个就很好理解了,通过鼠标放在不同月份月 ...

  2. 利用ANTLR4实现一个简单的四则运算计算器

    利用ANTLR4实现一个简单的四则运算计算器 ANTLR4介绍 ANTLR能够自动地帮助你完成词法分析和语法分析的工作, 免去了手写去写词法分析器和语法分析器的麻烦 它是基于LL(k)的, 以递归下降 ...

  3. Mountains(CVTE面试题)解题报告

    题目大意: 用一个数组代表群山的高度.高度大的地方代表山峰,小的地方代表山谷.山谷可以容水.假设有一天下了大雨,求群山中总共可以容纳多少水? 如图所示情况,a代表该数组,总共可以容纳5个水. 解题思路 ...

  4. PHPExcel导出功能

    对于第一次弄这个导出,总结下思路: 1.下载在http://phpexcel.codeplex.com/下载最新PHPExcel放到Vendor下,注意位置:ThinkPHP\Extend\Vendo ...

  5. 在XP上安装WinPython最新版本

    2015年3月30日星期一 16:01:47     晴 WinPython 新版本不再支持Windows XP平台,会出现错误提示WindowsError 127. 按照官网论坛上的解决方案(htt ...

  6. <基督教福音视频>

    <信耶稣还是罪人吗?>全集 http://www.youku.com/playlist_show/id_18458615.html <因信称义>全集 http://www.yo ...

  7. PostgreSQL的OGG -- bucardo

    bucardo是PostgreSQL数据库中实现双向同步的软件,可以实现PostgreSQL数据库的双master的方案,不过bucardo中的同步都是异步的,它是通过触发器记录变化,程序是perl写 ...

  8. a

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

  9. 利用反射+AOP,封装Basehandler

    AOP为Aspect Oriented Programming的缩写,意为:面向切面编程,通过预编译方式和运行期动态代理实现程序功能的统一维护的一种技术.AOP是OOP的延续,是软件开发中的一个热点, ...

  10. ASP.net如何保证EF操作类线程内唯一

    说到线程内唯一,肯定会想到单例模式,但是如果多用户访问网站就会出现问题.ASP.net中有两种方法可以保证EF操作类线程内唯一(目前只会这两种,以后有好的方法再添加): 1.httpcontext(实 ...