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. Mount DVD on CentOS

    Mount DVD on CentOS need to mount CD/DVD on CentOS Temporarily or Permanently? Here’s the Process Us ...

  2. Best Part

  3. 雾里看花般的迷茫--货运APP

    移动互联网正在改变我们的生活方式,各种手机APP充斥着人们的生活,物流行业也不例外.货运APP的出现,对于物流行业是一个提升的机会,也是迈向标准化和专业化的一个有效途径. 经过三十多年的发展,我国物流 ...

  4. Thinkphp批量添加数据

    //新建规格public function construction(){ $id = $_GET['id'];//dump($id);die; $this->assign('id', $id) ...

  5. 基于php开发的RESTful ApiDoc文档

    apiDoc基于rest的web API文档生成器,可以根据代码注释生成web api文档,自动生成静态的html网页文档,不仅支持项目版本号,还支持API版本号. 使用apiDoc不需要自己麻烦的调 ...

  6. PHP是弱类型语言,自动转换,强制转换

    强制转换: (int) - 转换成整型 (bool) - 转换.成布尔型 (float) - 转换成浮点型 (string) - 转换成字符串 (array) - 转换成数组 (object) - 转 ...

  7. 《利用python进行数据分析》读书笔记--第六章 数据加载、存储与文件格式

    http://www.cnblogs.com/batteryhp/p/5021858.html 输入输出一般分为下面几类:读取文本文件和其他更高效的磁盘存储格式,加载数据库中的数据.利用Web API ...

  8. js date 火狐不兼容 解决办法 火狐版本25,0

    <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...

  9. 如何静态添加toolbar到datagrid

    这个示例向你展示如何添加toolbar到datagrid. 创建 DataGrid <table id="tt" class="easyui-datagrid&qu ...

  10. Java-坦克大战

    利用Java语言中的集合.Swing.线程等知识点编写一个坦克大战游戏.(1) 画出敌我坦克的原理:在坦克类里面有一个布尔类型变量good.用于判断坦克的阵营,在创建坦克对象时在Tank类的构造方法中 ...