---
title: "centos 下tomcat使用开源SSL证书启用HTTPS"
author: "喧嚣求静"
date: "2017-08-22T12:30:24Z"
tags: []
categories: ["互联网"]
slug: "centos-tomcat-ssl-https"
draft: false
lastmod: "2017-08-22T12:30:24Z"
id: 2390643
url: "https://913.iteye.com/blog/2390643"
---

centos 下tomcat使用开源SSL证书启用HTTPS

项目需求使用HTTPS安全访问方式：

现有环境

centos 7,tomcat

查阅了大量的资料，方案

开源证书**Let's Encrypt ([linux下申请](https://diamondfsd.com/article/e221b455-b0e7-40b7-a6c7-9bb7e3e35657) ，[windows下申请](http://www.cnblogs.com/blog5277/p/6375473.html)）**

**申请证书，可以看我另一个转载的博客**  
**![](http://dl2.iteye.com/upload/attachment/0126/6422/b5b79538-1bff-3760-acc3-c0ca39a44af2.png)**  
 **证书到手，就是配置了**  
 **tomcat配置pem证书，需要arp支持，所有在centos 7中先安装**

 

```
 //配置gcc依赖
yum install gcc

//安装openssl
wget  https://www.openssl.org/source/openssl-1.1.0f.tar.gz
tar -zxvf openssl-1.1.0f.tar.gz
cd openssl-1.1.0f
./config --prefix=/usr/local/openssl
make && make install
   
   
  
   
   //安装apr
cd
wget http://mirror.bit.edu.cn/apache/apr/apr-1.6.2.tar.gz
tar -zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
./configure --prefix=/usr/local/apr
make && make install

//安装apr-util
cd
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.0.tar.gz
tar -zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

//安装tomcat-native
cd
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-connectors/native/1.2.12/source/tomcat-native-1.2.12-src.tar.gz
tar -zxvf tomcat-native-1.2.12-src.tar.gz
cd tomcat-native-1.2.12-src/native
./configure --with-apr=/usr/local/apr --with-ssl=/usr/local/openssl
make && make install


//配置环境变量
vi /etc/profile
//在末尾添加
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
source /etc/profile
```

 就是配置tomcat

![](http://dl2.iteye.com/upload/attachment/0126/6430/7456210a-b380-3332-b4d3-d82ea7d3d05e.png)