腾讯云域名申请+ssl证书申请+springboot配置https
阿里云域名申请
域名申请比较简单,使用微信注册阿里云账号并登陆,点击产品,选择域名注册

输入你想注册的域名

进入域名购买页面,搜索可用的后缀及价格,越热门的后缀(.com,.cn)越贵一般,并且很可能已经被注册。

最后,付款购买即可。
申请ssl证书
还是进入首页,点击产品按钮,在下拉菜单中选择ssl证书,进入后点立即购买,在下图中做如下选择

ssl证书是要与域名绑定的,按要求填好域名和邮箱,密码可以不填

填写好,选择下一步,然后选择手动dns,提交,然后查看证书详情。


进入域名解析页面,找到你刚创建的域名,点击解析,添加上面的记录

稍等1分钟,审核就会通过,然后就可以下载ssl证书,加压后有对应nginx、tomcat、apache等的证书,我们配置springboot,所以选择tomcat。
springboot配置https
新建一个springboot项目,加入web模块,将我们的证书copy到resrouce目录下,同时在application.yml中添加如下配置。
server:
port: 443
ssl:
enabled: true
key-store-password: o7yp31t85gu
key-store: classpath:hehang.xyz.jks
key-store-type: JKS
condition:
http2https: true
http:
port: 80
修改启动器,使其支持将http请求自动转化为https请求
package io.powerx; import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.context.annotation.Bean; @SpringBootApplication
public class TestsslApplication {
public static void main(String[] args) {
SpringApplication.run(TestsslApplication.class, args);
} // 如果没有使用默认值80
@Value("${http.port:80}")
Integer httpPort; // 正常启用的https端口 如443
@Value("${server.port}")
Integer httpsPort; // springboot2 写法
@Bean
@ConditionalOnProperty(name = "condition.http2https", havingValue = "true", matchIfMissing = false)
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint constraint = new SecurityConstraint();
constraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPattern("/*");
constraint.addCollection(collection);
context.addConstraint(constraint);
}
};
tomcat.addAdditionalTomcatConnectors(httpConnector());
return tomcat;
} @Bean
@ConditionalOnProperty(name = "condition.http2https", havingValue = "true", matchIfMissing = false)
public Connector httpConnector() {
System.out.println("启用http转https协议,http端口:" + this.httpPort + ",https端口:" + this.httpsPort);
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
// Connector监听的http的端口号
connector.setPort(httpPort);
connector.setSecure(false);
// 监听到http的端口号后转向到的https的端口号
connector.setRedirectPort(httpsPort);
return connector;
}
}
最后也是最重要的,如果你使用的是云服务器,那么只需要在腾讯云平台配置下域名解析(选择快速添加网站,配置云服务器的公网ip,按照提示添加下面两条记录),注意配置安全组,开放80和443端口,然后将项目打包部署到云服务器上即可。

如果你是在本地服务器部署,则首先需要进行外网映射配置,我这里就是将我要部署的服务器映射到公网ip的1234端口(也想用80端口,无奈没有开通),然后再去腾讯云配置域名解析,最后部署即可,贴上我的安全标示,哈哈

腾讯云域名申请+ssl证书申请+springboot配置https的更多相关文章
- 阿里云域名的ssl证书申请与腾讯服务器域名的证书安装
阿里云域名中的SSL证书申请,腾讯云服务器中的证书安装: 因为公司的与域名都在阿里云上面,服务器却用的是腾讯云的.记得前2年用阿里云管理平台的时候,域名的SSL证书都很好找,也许是长时间不用,找SSL ...
- 腾讯云申请SSL证书与Nginx配置Https
0x00 为什么要安装证书 信息传输的保密性 数据交换的完整性 信息的不可否认性 交易者身份确定性 如今各大浏览器厂商不断推进Https安全访问强制性要求,为了避免以后网站数据量增多时安装证书造成不必 ...
- 七牛云域名DV SSL证书申请流程以及CDN融合加速配置
从2017年起,苹果ios以及微信小程序都陆续要求请求连接request地址是使用HTTPS协议的.所以在项目开发阶段就要考虑解决https的问题,同时这也是为项目实际安全所考虑.最近我也是在折腾项目 ...
- 【http转https】其之一:腾讯云 DV SSL证书申请实验
文:铁乐猫 2016年1月 前言 大概2017年12月28日左右公司提出以后需要将公司网站由http提升到https级别,以便谷歌和火狐浏览器将之认定为安全网站. 主要是出于客户.用户那边用火狐或谷歌 ...
- 超详细网站博客域名和二级域名、子域名升级HTTPS免费申请SSL证书配置nginx指南
随着互联网的飞速发展,我们的工作生活已经离不开互联网,HTTP虽然使用极为广泛, 但是存在不小的安全缺陷, 主要是其数据的明文传送和消息完整性检测的缺乏, 而这两点恰好是网络支付,网络交易等网站应用中 ...
- 阿里云申请SSL证书 并部署到SpringBoot项目
前提 有一台阿里云的服务器(安装了java环境) 有已经备案的域名,并且域名绑定上面的服务器 申请SSL证书 申请教程:https://blog.csdn.net/yunweifun/article/ ...
- Linux服务系统申请SSL证书方法
inux主要面向专业性较强的技术人员,如果是WEB站点通常采取PHP语言为主选,可选的服务器环境中有Apache.Nginx.Tomcat这几类为主的框架环境,有的图方便会用一些可视化一键式的控制面板 ...
- 亚马逊EC2服务器申请+NODE服务器部署+阿里云域名申请+SSL证书使用
最近,由于项目需要,自己申请了一台亚马逊用于部署网站测试,在使用期间,发现网上没有一篇非常完整的文章讲解从服务器申请到域名解析,SSL证书申请的整个流程.所以自己总结一下,以供大家学习! 一.亚马逊E ...
- 阿里云免费SSL证书申请与安装使用(IIS7)
准备: 阿里云已完成备案的域名一个 第一步:免费SSL证书申请 登陆阿里云平台,在域名控制台下,选择你的域名,点击“SSL”证书,如图所示 再跳转后的页面,选择“单域名免费证书”,并补全域名,非二级域 ...
随机推荐
- Jsp+servlet+mysql搭建套路
1.建立数据库根据需求建立相应的数据库确立数据库的字段.属性.主键等2.建立javaweb项目,搭建开发环境在开发环境的/WebRoot/WEB-INF下建立lib文件夹,存放需要使用的jar包常用的 ...
- HDU 2106 decimal system (进制转化求和)
题意:给你n个r进制数,让你求和. 析:思路就是先转化成十进制,再加和. 代码如下: #include <iostream> #include <cstdio> #includ ...
- cmd运行命令
winver检查Windows版本 dxdiag检查DirectX信息 mem.exe显示内存使用情况 Sndvol32音量控制程序 sfc.exe系统文件检查器 gpedit.msc 组策略 reg ...
- http://localhost:8080/hello?wsdl
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-u ...
- TableView编辑状态下跳转页面的崩溃处理
29down votefavorite 12 I have a viewController with a UITableView, the rows of which I allow to edit ...
- (网络流 模板 Dinic) Drainage Ditches --POJ --1273
链接: http://poj.org/problem?id=1273 代码: //Dinic #include<stdio.h> #include<string.h> #inc ...
- 西邮Linux兴趣小组2014级免试挑战题
原文链接:西邮Linux兴趣小组2014级免试挑战题 又到了小组纳新的季节^_^,时间过的真快! 想起去年这会儿自己做免试题的时候根本找不着北@_@ 有幸今年能够在这里和大家分享免试挑战题,也正如我 ...
- 循环读取list 的几种方法?
1.最常用的方法.循环找出该位子的list元素for(int i = 0;i < list.size(); i ++){System.out.println(list.get(i));}2.利用 ...
- Paul Simon -- Duncan
Paul Simon -- Duncan (London,January 1972) Couple in the next roomBound to win a prizeTheyve been go ...
- The transaction associated with this command is not the connection's active transaction
The fix is fairly simple: if you want a Dapper query to participate in a connection, explicitly deno ...