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 ...
随机推荐
- Nacos深入浅出(三)
EventDispatcher.fireEvent(new ConfigDataChangeEvent(true, dataId, group, tenant, time.getTime())); 跟 ...
- jquery jtemplates.js模板渲染引擎的详细用法第一篇
jquery jtemplates.js模板渲染引擎的详细用法第一篇 Author:ching Date:2016-06-29 jTemplates是一个基于JQuery的模板引擎插件,功能强大,有了 ...
- vue中params & query的比较
共同点: 1.都可以传值 2.在另外一个组件中传递值的时候,都是放在$route中 不同点: 1.传值时候,url的表现不一样 query /orderInfo?xxx=yyy&aaa=bbb ...
- 5.用通配符进行过滤 ---SQL
一.LIKE操作符 通配符(wildcard) 用来匹配值的一部分的特殊字符.搜索模式(search pattern)由字面值.通配符或两者组合构成的搜索条件.通配符本身实际上是SQL的WHERE子句 ...
- 优化MyEclipse编译速度慢的问题
转载大神的 https://www.cnblogs.com/luxd/p/5999217.html
- High waits on control file sequential read
High waits on control file sequential read (文档 ID 2277867.1) In case we run into an issue where cont ...
- Even-odd Boxes hackerrank 分类讨论
https://www.hackerrank.com/contests/101hack50/challenges/even-and-odd-boxes/editorial 昨晚做的时候卡了挺久的. 首 ...
- 4. 把一幅彩色图像的R、G、B分量单独显示。
#include <cv.h> #include <highgui.h> int main(void) { IplImage* oo = cvLoadImage(); IplI ...
- AJPFX关于Java中运用数组的四种排序方法
JAVA中在运用数组进行排序功能时,一般有四种方法:快速排序法.冒泡法.选择排序法.插入排序法.快速排序法主要是运用了Arrays中的一个方法Arrays.sort()实现.冒泡法是运用遍历数组进行比 ...
- 遍历List集合的方式
遍历List集合的方式有很多,现在举出最常见的三种 List<String> list = new ArrayList<String>(); list.add("a& ...