天天看点

nginx+tomcat https实践

1. 安装ssl'证书

使用Let's Encrypt 的免费证书:

下载源代码:

git clone https://github.com/letsencrypt/letsencrypt

我时阿里云的机器,下载的有点慢,100k以内,稍等几分钟就好了

nginx+tomcat https实践

执行安装下载脚本:

cd letsencrypt

./letsencrypt-auto certonly --standalone --email admin@****.com -d test.com -d www.test.com

参数 d 为域名,多个域名直接在后面继续加就行

nginx+tomcat https实践

看到这个界面,直接Agree回车。

nginx+tomcat https实践

 3秒钟后完成

nginx+tomcat https实践
nginx+tomcat https实践

 有三个月的有效期,2017-02-14过期,需要重新执行命令重新生成新的证书

证书存放在/etc/letsencrypt/下

nginx+tomcat https实践

2. 配置nginx:

nginx需要在编译的时候加入  --with-http_ssl_module 支持

   ./configure --prefix=${dir}/nginx --with-http_ssl_module

站点mall.conf配置:

nginx+tomcat https实践

 配置完后reload nginx即可

 3.tomcat server.xml配置有两处需要修改的:

nginx+tomcat https实践
nginx+tomcat https实践

 修改后重启tomcat

转载于:https://www.cnblogs.com/xiang-/p/6071499.html