springboot下https证书配置
没有证书的小伙伴首先申请一个阿里云免费证书,按照我的步骤来操作
1、购买页面是这样的

按照顺序选择

神奇的一幕出现了

然后就去购买成功,我们会看到证书没有签发,我们需要去申请

填写需要绑定的域名

一般等个半个小时就会审核成功,然后下载tomcat证书,我们解压证书压缩包,看到如下信息

新建一个springboot项目(web项目)
将证书拷贝到资源目录下

配置application.properties文件
server.port=
server.ssl.key-store=classpath:cert-1541418663536_iunix.vip.pfx
server.ssl.key-store-password=krdg77SD
server.ssl.keyStoreType=PKCS12
密码值在对应的证书包中的文本文件中,上图中list.html代码如下
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" />
<title>Insert title here</title>
</head>
<body>
<h2>用户列表</h2>
<div>
<ul>
<li th:each="user:${users}">
<span th:text="${user.id}"></span>-
<span th:text="${user.name}"></span>-
<span th:text="${user.age}"></span>-
<span th:text="${user.address}"></span>
</li>
</ul>
</div>
</body>
</html>
创建一个Controller 一个实体类,代码分别如下
/**
* @Auther: Tang XiaoBai
* @Date: 2018/11/7 20:24
* @Description:
*/
@Controller
public class UserController { @RequestMapping("/list")
public String listUser(Model model) {
List<User> userList = new ArrayList<User>();
for (int i = 0; i <10; i++) {
userList.add(new User(i,"张三"+i,20+i,"中国广州"));
}
model.addAttribute("users", userList);
return "list";
}
}
/**
* @Auther: Tang XiaoBai
* @Date: 2018/11/7 20:26
* @Description:
*/
public class User {
private Integer id;
private String name;
private Integer age;
private String address;
//省略get和set方法、构造函数
}
将这个项目打包部署到云服务器上,启动,用浏览器访问域名,效果如下,大功告成。

springboot下https证书配置的更多相关文章
- HTTPS 证书配置
HTTPS 证书配置 现在阿里云和腾讯云都支持申请 HTTPS 证书,这里不再提,有需要的可自行google解决方案. 本文主要介绍的是通过 letsencrypt 申请免费的HTTPS证书,并将其配 ...
- nginx 反向代理及 https 证书配置
nginx 反向代理及 https 证书配置 author: yunqimg(ccxtcxx0) 1. 编译安装nginx 从官网下载 nginx源码, 并编译安装. ./configure --pr ...
- springboot https证书配置
如果公司有提供证书如: 拿到证书秘钥可直接在springboot 的配置文件中配置: server.ssl.key-store=classpath:cert.pfx server.ssl.key-st ...
- Https证书配置
本文介绍配置免费证书的方法 具体步骤: 一.获取免费CA证书 步骤1到腾讯云找到: 二.申请完成 后域名验证指引 申请域名型证书,可以通过以下方式验证域名的所有权: 1. 手动 DNS 验证 通过解析 ...
- nginx 之 https 证书配置
HTTPS原理和作用 为什么需要HTTPS 原因:HTTP不安全 传输数据被中间人盗用.信息泄露 数据内容劫持.篡改 HTTPS协议的实现 对传输内容进行加密以及身份验证 对称加密:加密秘钥和解密秘钥 ...
- apache2 以及https证书配置
环境Ubuntu12.04 server 配置 1,首先在进入找到/etc/apache2/apache2.conf的配置文件,里面有包含了较多配置文件的路径如:httpd.conf/ports.co ...
- spring-boot下mybatis的配置
问题描述:spring boot项目想添加mybatis的配置,在src/main/resources目录下新建了mybatis-config.xml文件,在application.propertie ...
- SpringBoot下Schdule的配置与使用
我们在平常项目开发中,经常会用到周期性定时任务,这个时候使用定时任务就能很方便的实现.在SpringBoot中用得最多的就是Schedule. 一.SpringBoot集成Schedule 1.依赖配 ...
- nginx https证书配置
1. Nginx配置 server { listen 443; #指定ssl监听端口 server_name www.example.com; ssl on; #开启ssl支持 ssl_certifi ...
随机推荐
- 一篇关于完全动态凸包的paper(侵删)
先放原文,挖个坑,到时候再来说人话ε=(´ο`*))) 作者:Franco P. Preparata 出处:Computational geometry An introduction The tec ...
- Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises) B
Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has n apartme ...
- 2017 Multi-University Training Contest - Team 7 Just do it
http://acm.hdu.edu.cn/showproblem.php?pid=6129 题意:一次操作就是i从1~n有 A[i]=A[i]^A[i-1]^A[i-2]...^A[1] 那么这样操 ...
- 服务是如何加载并运行的, Kestrel、配置与环境
服务是如何加载并运行的, Kestrel.配置与环境 "跨平台"后的ASP.Net Core是如何接收并处理请求的呢? 它的运行和处理机制和之前有什么不同? 本章从"宏观 ...
- MyBatis配置文件之properties属性
MyBatis提供3个方式使用properties: 1.property子元素. 2.properties文件. 3.程序代码传递. properties属性系给系统配置一些运行参数,一般放在XML ...
- go日志输入到es
1.依赖 github.com/alecthomas/log4go 2.配置 <filter enabled="true"><!-- enabled=false ...
- IDEA在debug模式项目启动一半卡主,无法启动,也不报错
罪魁祸首就是手误 点了一下代码中方法的左侧打了个方法断点 Java Method Breakpoints 有时候debug启动很慢也有可能是这个原因,记录一下
- 集合(Map、可变参数、Collections)
集合 第1章 Map接口 1.1 Map接口概述 我们通过查看Map接口描述,发现Map接口下的集合与Collection接口下的集合,它们存储数据的形式不同,如下图. l Collection中的集 ...
- new() 与new
一般写的时候,new对象都要加()
- Vue Scroller:Vue 下拉刷新及无限加载组件
Vue Scroller Vue Scroller is a foundational component ofVonic UI. In purpose of smooth scrolling, pu ...