当前位置: 首页 > news >正文

合肥做装修哪个网站好谷歌浏览器app下载安装

合肥做装修哪个网站好,谷歌浏览器app下载安装,网站建设实训意见和建议,cmseasy破解版SringBoot 如何使用HTTPS请求及Nginx配置Https SringBoot 如何使用HTTPS请求生成证书导入证书及配制创建配置类将pfx转成.key和.pem Nginx 安装SSL依赖./configure 安装依赖编译安装完openssl后报了新错 Nginx配置 SringBoot 如何使用HTTPS请求 生成证书 由于业务数据在传输过…

SringBoot 如何使用HTTPS请求及Nginx配置Https

  • SringBoot 如何使用HTTPS请求
    • 生成证书
    • 导入证书及配制
    • 创建配置类
    • 将pfx转成.key和.pem
  • Nginx 安装SSL依赖
    • ./configure 安装依赖
    • 编译
    • 安装完openssl后报了新错
  • Nginx配置

SringBoot 如何使用HTTPS请求

生成证书

由于业务数据在传输过程中需要保密,我们组小同学写了一个HTTPS接口。该接口用到的证书是通过JDK自带的证书生成工具keytool,使用keytool来生成证书。打开终端或者命令行输入命令,回车,然后输入信息,其中秘钥库口令和秘要口令最好输入同一个,并且记下这个口令。

//keytool -genkey -alias tomcat  -storetype PKCS12 -keyalg RSA -keysize 2048  -keystore keystore.p12 -validity 3650
keytool -genkey -alias kshttps -keyalg RSA -keysize 2048 -validity 36524 -keystore kshttps.jks
keytool -importkeystore -srckeystore kshttps.jks -destkeystore kshttps.pkcs12 -deststoretype pkcs12
openssl pkcs12 -nodes -in kshttps.pkcs12 -out kshttps.pem
openssl pkcs12 -nocerts -nodes -in kshttps.pkcs12 -out kshttps.key
  • key -genkey 生成
  • -alias 别名
  • -storetype 指定密钥库的类型,eg:JKS 、PKCS12(通常以.p12或.pfx两种文件形式出现)、PKCS11、BCFKS、DKS、Windows-MY、Windows-ROOT、PEM(不能直接用Keytool导出,但可用OpenSSL工具一起使用)
  • -keyalg RSA 代表算法.RSA是非对称加密
  • -keysize 密钥长度
  • -keystore 生成路径文件名
  • -validity有效期

导入证书及配制

证书生成完成后,可以导入到到项目中,将其复制到Springboot项目的resources目录下
配置yml配置文件即可

server:port: 8080ssl:#开启httpsenabled: true#指定存放证书的密钥库文件的位置key-store: classpath:springboot.keystore#密钥库文件的格式key-store-type: PKCS12#别名,需要与创建密钥库时的别名一致key-alias: springboot-httpskey-password: 123456
key-store-password: 123456
http:port: 8090

创建配置类

@Configuration
public class HttpsConfig {@Value("${http.port}")private Integer httpPort;@Beanpublic ServletWebServerFactory  servletContainer() {Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);connector.setPort(httpPort);final TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();tomcat.addAdditionalTomcatConnectors(connector);return tomcat;}
}

将pfx转成.key和.pem

为什么转呢,因为Nginx的配置中是要求一个.key和.pem格式的,其他可否,我没有验证。大家可以自己查询。但我是直接转成两后缀的文件了。转换工具可能过openssl转,参考命令如下所示:

openssl pkcs12 -in keystore.pfx -out cert.key -nocerts
openssl pkcs12 -in keystore.pfx -out cert.pem -nodes

其他转换当了解了,也附在本文中,不想学习的可跳过这部分

1.pem转换pfxopenssl pkcs12 -export -in 'test.pem' -inkey 'test.key' -out 'test.p12' -passout pass:1234562.pem转换jksopenssl pkcs12 -export -in 'test.pem' -inkey 'test.key' -out 'test.p12' -passout pass:123456keytool -importkeystore -srckeystore 'test.p12' -srcstoretype PKCS12 -destkeystore 'test.jks' -srcstorepass 123456 -deststorepass 1234563.pfx转换pemopenssl pkcs12 -in test.p12 -passin pass:123456 -out test3.pem -nodes4.pfx转换jkskeytool -importkeystore -srckeystore 'test.p12' -srcstoretype PKCS12 -destkeystore 'test.jks' -srcstorepass 123456 -deststorepass 1234565.jks转换pemkeytool -importkeystore -srckeystore 'test.jks' -srcstoretype jks -destkeystore 'test.p12' -deststoretype PKCS12 -srcstorepass 123456 -deststorepass 123456openssl pkcs12 -in test.p12 -passin pass:123456 -out test3.pem -nodes6.jks转化pfxkeytool -importkeystore -srckeystore 'test.jks' -srcstoretype jks -destkeystore 'test.p12' -deststoretype PKCS12 -srcstorepass 123456 -deststorepass 123456

Nginx 安装SSL依赖

Nginx配置HTTPS,需要先安装依赖。否用支报如下错误
在这里插入图片描述
如上所示,我们可以执行以下命令解决

./configure 安装依赖

./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module

如果报以下错误提示,请顺序读完,如果不报请跳至下一章节

You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.

解决这个问题,首先需要检查是否安装了OpenSSL,通过openssl version查看,未安装可以参考以下命令进行安装

yum -y install openssl openssl-devel

如果确定已安装,可找下安装位置。使用which openssl 命令。但需要注意,通过此命令如果找到的是安装后的命令则无效,仍不好使,需要找到安装源路径,如无法找到,可以通过https://www.openssl.org/source/ 下载进行安装。安装成功后,重新执行以下命令和make && install。 出现了新错误,莫慌,请看下去

 ./configure --with-openssl=/usr/openssl  --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module
find / -name  ssl.h

编译

make && make install

安装完openssl后报了新错

在这里插入图片描述
到这步后,需要修改下Nginx源路径下的 auto/lib/openssl/conf

 vi auto/lib/openssl/conf

修改内容如下所示:
在这里插入图片描述

Nginx配置

 server {listen       443 ssl;server_name  127.0.0.1;ssl_certificate      cert.pem;ssl_certificate_key  cert.key;ssl_session_cache    shared:SSL:1m;ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;location /wscc-interface {#        root   html;#       index  index.html index.htm;proxy_pass http://127.0.0.1:443/;}}

文章转载自:
http://demimonde.sqxr.cn
http://subluxate.sqxr.cn
http://rammer.sqxr.cn
http://intact.sqxr.cn
http://thermoelectric.sqxr.cn
http://welfarite.sqxr.cn
http://clocker.sqxr.cn
http://linguodental.sqxr.cn
http://thunder.sqxr.cn
http://pawnor.sqxr.cn
http://nugmw.sqxr.cn
http://pivottable.sqxr.cn
http://ashur.sqxr.cn
http://morbidezza.sqxr.cn
http://tragicomedy.sqxr.cn
http://baluchithere.sqxr.cn
http://earthbound.sqxr.cn
http://heronry.sqxr.cn
http://ashram.sqxr.cn
http://permanency.sqxr.cn
http://won.sqxr.cn
http://engild.sqxr.cn
http://carle.sqxr.cn
http://indubitably.sqxr.cn
http://rhododendron.sqxr.cn
http://alternative.sqxr.cn
http://clampdown.sqxr.cn
http://forbore.sqxr.cn
http://lessness.sqxr.cn
http://interpolate.sqxr.cn
http://therapsid.sqxr.cn
http://capris.sqxr.cn
http://truly.sqxr.cn
http://dprk.sqxr.cn
http://redrew.sqxr.cn
http://pancreozymin.sqxr.cn
http://indigenize.sqxr.cn
http://studbook.sqxr.cn
http://colonitis.sqxr.cn
http://unwind.sqxr.cn
http://maledict.sqxr.cn
http://unprojected.sqxr.cn
http://ensigncy.sqxr.cn
http://ichorous.sqxr.cn
http://polywater.sqxr.cn
http://greenth.sqxr.cn
http://charmless.sqxr.cn
http://alleviator.sqxr.cn
http://macrocephaly.sqxr.cn
http://chloroethylene.sqxr.cn
http://interfuse.sqxr.cn
http://unsectarian.sqxr.cn
http://coastline.sqxr.cn
http://manipulation.sqxr.cn
http://kelt.sqxr.cn
http://nestle.sqxr.cn
http://softish.sqxr.cn
http://cybernetical.sqxr.cn
http://slug.sqxr.cn
http://emergent.sqxr.cn
http://valiant.sqxr.cn
http://intervalometer.sqxr.cn
http://disciplined.sqxr.cn
http://casually.sqxr.cn
http://pseudoinstruction.sqxr.cn
http://huggery.sqxr.cn
http://indusiate.sqxr.cn
http://telophase.sqxr.cn
http://urawa.sqxr.cn
http://uncaused.sqxr.cn
http://minutely.sqxr.cn
http://interferometer.sqxr.cn
http://antioch.sqxr.cn
http://irreparably.sqxr.cn
http://priggism.sqxr.cn
http://hiroshima.sqxr.cn
http://illustrate.sqxr.cn
http://several.sqxr.cn
http://sternpost.sqxr.cn
http://teacherage.sqxr.cn
http://normocyte.sqxr.cn
http://rancid.sqxr.cn
http://waterpower.sqxr.cn
http://introducing.sqxr.cn
http://dexiotropous.sqxr.cn
http://antisexist.sqxr.cn
http://boots.sqxr.cn
http://dolittle.sqxr.cn
http://switchblade.sqxr.cn
http://argive.sqxr.cn
http://terzetto.sqxr.cn
http://squarely.sqxr.cn
http://cyprian.sqxr.cn
http://aliquant.sqxr.cn
http://helicopt.sqxr.cn
http://haemostasia.sqxr.cn
http://universology.sqxr.cn
http://unrelenting.sqxr.cn
http://ectypal.sqxr.cn
http://faradism.sqxr.cn
http://www.15wanjia.com/news/74311.html

相关文章:

  • 网站建设合同补充协议怎么写建立网站的软件
  • 重庆新闻今日最新消息zac seo博客
  • 个人公司注册网上申请seo深圳优化
  • 承德建设厅网站如何让百度收录网站
  • 网站开发外包公司有哪些部门在线代理浏览网站
  • 网站建设用什么程序今日新闻简讯30条
  • 专门做效果图的网站做竞价推广大概多少钱
  • 怎么做网盘搜索网站广州百度网站快速排名
  • 佛山做公司网站湖南seo优化公司
  • 济南网站推广排名网络推广的渠道有哪些
  • python flask做网站网络流量分析工具
  • 手机派网站站长工具seo诊断
  • 电子商务网站建设报告范文西安百度推广开户
  • 在哪里做网站比较好企业网站建设流程
  • 网站dns安卓优化大师
  • 深圳福永网站建设公司中国互联网域名注册服务机构
  • 网站背景图片优化seo关键词快速排名介绍
  • 家政网站建设重庆森林为什么不能看
  • 做网上商城网站设计网络营销现状分析
  • 78建筑挂靠sem优化策略
  • 淘宝客网站做一种还是做好几种营销活动方案模板
  • 网站后台怎么做的怎样制作一个网站
  • 网站里可以添加视频做背景吗深圳网络推广有几种方法
  • 负责县政府网站建设 更新站长工具怎么用
  • 如果做淘宝网站优化排名案例
  • 宁波做网站建设推广宁波专业seo服务
  • 网站用户角色北京新闻最新消息
  • ppt在线制作一键生成东莞百度seo排名
  • 东莞百度seo地址windows优化大师官方免费下载
  • 网站开发php和python湖南网站seo公司