设为首页
收藏本站
开启辅助访问
综合门户
Portal
TOP云服务器
企业级云服务器、云数据库、裸金属服务器、智能云建站服务
技术社区
云计算与站长技术交流BBS社区
模板下载
网站模板、APP模板、小程序模板下载
IT考试
阿里云ACP考试、华为云认证等IT考试题在线练习
IT云问答
本版
文章
帖子
群组
用户
QQ登录
微信登录
忘记密码?
注册
登录
云服务器
物理服务器
云虚拟主机
智能建站/小程序
IT云问答
IT考试
[云服务器优惠活动]
一些性价比高值得推荐的云服务器和物理服务
[云服务器优惠活动]
模板建站、自助建站,我推荐百度智能建站!
[IT综合技术交流]
如何搭建Socks5代理?云服务器搭建sk5教程
[建站技术分享]
wordpress主题模板开发制作教程
[云服务器优惠活动]
天翼云618年中钜惠优惠活动 云服务器16元起
[云服务器优惠活动]
腾讯云特邀VIP会员享全场云产品5折优惠!
如何搭建Socks5代理?
腾讯云特邀VIP会员享
百度智能云特邀请VIP
天翼云特邀VIP会员注
云服务器交流社区
»
技术社区
›
云安全防御交流
›
SSL域名证书
›
在Jetty服务器上安装SSL证书教程
返回列表
发布主题
在Jetty服务器上安装SSL证书教程
[复制链接]
查看:
763
|
回复:
0
色性
色性
当前离线
积分
54
窥视卡
雷达卡
14
主题
14
帖子
54
积分
注册会员
注册会员, 积分 54, 距离下一级还需 146 积分
注册会员, 积分 54, 距离下一级还需 146 积分
积分
54
收听TA
发消息
发表于 2020-1-15 17:51:51
|
显示全部楼层
|
阅读模式
云服务器2核2G 5M 1个IP 90G硬盘 20G独享防御 37元/月,安全稳定、续费同价,点击了解>>>
在Jetty服务器上安装
SSL证书
教程:
首先你得有SSL证书,没有的可以到腾讯云和阿里云申请免费SSL证书
(参考:
阿里云、腾讯云免费SSL域名证书申请教程
),或者购买SSL证书。
1、Jetty服务器版本确认。建议使用Jetty 9.2.22及以上版本。
2、从阿里云下载tomcat格式的证书。非系统生成的CSR需要生成pfx证书密匙对文件,转换命令如下。
openssl pkcs12 -export -out 214362464370691.pfx -inkey 214362464370691.key -in 214362464370691.pem
复制代码
3、转换pfx的证书密匙对文件为jks格式,转换命令如下:
(说明 Windows环境注意在%JAVA_HOME%/jdk/bin目录中执行。)
keytool -importkeystore -srckeystore 密匙对文件.pfx -destkeystore 证书名称.jks -srcstoretype PKCS12 -deststoretype JKS
复制代码
回车后输入两次要设置的jks格式证书密码,然后输入一次pfx证书密码。三次密码必须输入pfx-password.txt记录的密码。jks密码与pfx证书密码相同,否则可能会导致Jetty服务器启动失败。
4、配置Jetty的SSL。
确保Jetty的http页面可正常访问。
拷贝证书。进入Jetty服务器目录下的etc,新建存放jks格式证书的目录,并复制jks格式证书至当前目录
# pwd
/opt/jetty9222/etc
# mkdir cert
# cd cert/
# cp ../../../keys/jetty.jks .
# ls
jetty.jks
复制代码
编辑Jetty服务器目录中的etc中的jetty-ssl.xml文件,设置证书相关参数(密码设置均为pfx-password.txt所记录的密码)。
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Configure a TLS (SSL) Context Factory -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- and either jetty-https.xml or jetty-spdy.xml (but not both) -->
<!-- ============================================================= -->
<Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/cert/jetty.jks"/></Set>
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="214362464370691"/></Set>
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Configure a TLS (SSL) Context Factory -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- and either jetty-https.xml or jetty-spdy.xml (but not both) -->
<!-- ============================================================= -->
<Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory">
<Set name="KeyStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.keystore" default="etc/cert/jetty.jks"/></Set>
<Set name="KeyStorePassword"><Property name="jetty.keystore.password" default="214362464370691"/></Set>
<Set name="KeyManagerPassword"><Property name="jetty.keymanager.password" default="214362464370691"/></Set>
<Set name="TrustStorePath"><Property name="jetty.base" default="." />/<Property name="jetty.truststore" default="etc/cert/jetty.jks"/></Set>
<Set name="TrustStorePassword"><Property name="jetty.truststore.password" default="214362464370691"/></Set>
<Set name="EndpointIdentificationAlgorithm"></Set>
<Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
<Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
<Set name="ExcludeCipherSuites">
<Array type="String">
<Item>SSL_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_RSA_WITH_DES_CBC_SHA</Item>
<Item>SSL_DHE_DSS_WITH_DES_CBC_SHA</Item>
<Item>SSL_RSA_EXPORT_WITH_RC4_40_MD5</Item>
<Item>SSL_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA</Item>
<Item>SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA</Item>
</Array>
</Set>
<!-- =========================================================== -->
<!-- Create a TLS specific HttpConfiguration based on the -->
<!-- common HttpConfiguration defined in jetty.xml -->
<!-- Add a SecureRequestCustomizer to extract certificate and -->
<!-- session information -->
<!-- =========================================================== -->
<New id="sslHttpConfig" class="org.eclipse.jetty.server.HttpConfiguration">
<Arg><Ref refid="httpConfig"/></Arg>
<Call name="addCustomizer">
<Arg><New class="org.eclipse.jetty.server.SecureRequestCustomizer"/></Arg>
</Call>
</New>
</Configure>
复制代码
编辑Jetty服务器目录中的etc中的jetty-https.xml文件,配置https所使用的443端口。
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<!-- ============================================================= -->
<!-- Configure a HTTPS connector. -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- and jetty-ssl.xml. -->
<!-- ============================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- =========================================================== -->
<!-- Add a HTTPS Connector. -->
<!-- Configure an o.e.j.server.ServerConnector with connection -->
<!-- factories for TLS (aka SSL) and HTTP to provide HTTPS. -->
<!-- All accepted TLS connections are wired to a HTTP connection.-->
<!-- -->
<!-- Consult the javadoc of o.e.j.server.ServerConnector, -->
<!-- o.e.j.server.SslConnectionFactory and -->
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
<!-- that may be set here. -->
<!-- =========================================================== -->
<Call id="httpsConnector" name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="acceptors" type="int"><Property name="ssl.acceptors" default="-1"/></Arg>
<Arg name="selectors" type="int"><Property name="ssl.selectors" default="-1"/></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.SslConnectionFactory">
<Arg name="next">http/1.1</Arg>
<Arg name="sslContextFactory"><Ref refid="sslContextFactory"/></Arg>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="sslHttpConfig"/></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="https.port" default="443" /></Set>
<Set name="idleTimeout"><Property name="https.timeout" default="30000"/></Set>
<Set name="soLingerTime"><Property name="https.soLingerTime" default="-1"/></Set>
<Set name="acceptorPriorityDelta"><Property name="ssl.acceptorPriorityDelta" default="0"/></Set>
<Set name="selectorPriorityDelta"><Property name="ssl.selectorPriorityDelta" default="0"/></Set>
<Set name="acceptQueueSize"><Property name="https.acceptQueueSize" default="0"/></Set>
</New>
</Arg>
</Call>
</Configure>
复制代码
编辑Jetty服务器目录中的start.ini文件,按需求更改端口号,并设置启动加载jetty-https.xml,jetty-ssl.xml。
jetty.port=80
jetty.dump.stop=
etc/jetty-ssl.xml
etc/jetty-https.xml
复制代码
重启Jetty,验证https访问是否正常。
安装SSL证书
,
SSL证书安装
相关帖子
•
在Nginx/Tengine服务器上安装证书教程
•
在IIS服务器上安装SSL证书教程
•
在GlassFish服务器上安装SSL证书教程
•
在JBoss服务器上安装SSL证书教程
•
IIS服务器多域名SSL证书443端口放行配置教程
•
exchange ssl证书多少钱?exchange ssl证书怎么安装?
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
千斤顶
照妖镜
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
立即注册
本版积分规则
发表回复
回帖并转播
回帖后跳转到最后一页
精彩图文
如何搭建Socks5代理?云服务器搭建sk5教程
近期有比较多的小伙伴在问如何搭建Socks5代理实现游戏加速,这里就给大家放出一个详细
王建军
腾讯云特邀VIP会员享全场云产品5折优惠!
腾讯云特邀VIP会员享全场云产品5折优惠! 点击这里申请腾讯云特邀VIP会员,享全场云
不败天使
百度智能云特邀请VIP会员1元体验活动,40款
百度智能云特邀请VIP会员1元体验活动,40款云产品邀你体验 点击这里立即申请百度智
卧是大春绿
天翼云特邀VIP会员注册,享天翼云产品终身
天翼云十周年有哪些优惠套餐呢? 云主机1核2G低至2.4元/月 29元/年 通用型云主机
仁寿艺影
快速回复
返回顶部
返回列表