51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

腾讯域名Https访问,Tomcat配置详解

1.腾讯云里面SSL证书有有申请证书按钮,点击进行申请,有一个免费一年的,直接按照正常流程填写完等待审核就可以啦 {#1.%E8%85%BE%E8%AE%AF%E4%BA%91%E9%87%8C%E9%9D%A2ssl%E8%AF%81%E4%B9%A6%E6%9C%89%E6%9C%89%E7%94%B3%E8%AF%B7%E8%AF%81%E4%B9%A6%E6%8C%89%E9%92%AE%EF%BC%8C%E7%82%B9%E5%87%BB%E8%BF%9B%E8%A1%8C%E7%94%B3%E8%AF%B7%EF%BC%8C%E6%9C%89%E4%B8%80%E4%B8%AA%E5%85%8D%E8%B4%B9%E4%B8%80%E5%B9%B4%E7%9A%84%EF%BC%8C%E7%9B%B4%E6%8E%A5%E6%8C%89%E7%85%A7%E6%AD%A3%E5%B8%B8%E6%B5%81%E7%A8%8B%E5%A1%AB%E5%86%99%E5%AE%8C%E7%AD%89%E5%BE%85%E5%AE%A1%E6%A0%B8%E5%B0%B1%E5%8F%AF%E4%BB%A5%E5%95%A6}

image-1646982768015
image-1646982772760

2.审核成功之后,就可以看到自己申请的证书了,然后点击下载,再把你下载的附件解压 {#2.%E5%AE%A1%E6%A0%B8%E6%88%90%E5%8A%9F%E4%B9%8B%E5%90%8E%EF%BC%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%9C%8B%E5%88%B0%E8%87%AA%E5%B7%B1%E7%94%B3%E8%AF%B7%E7%9A%84%E8%AF%81%E4%B9%A6%E4%BA%86%EF%BC%8C%E7%84%B6%E5%90%8E%E7%82%B9%E5%87%BB%E4%B8%8B%E8%BD%BD%EF%BC%8C%E5%86%8D%E6%8A%8A%E4%BD%A0%E4%B8%8B%E8%BD%BD%E7%9A%84%E9%99%84%E4%BB%B6%E8%A7%A3%E5%8E%8B}

image-1646982784693

3.解压之后你打开文件夹,你会发现是下面的样子,我们今天说的是Tomcat的配置方法 {#3.%E8%A7%A3%E5%8E%8B%E4%B9%8B%E5%90%8E%E4%BD%A0%E6%89%93%E5%BC%80%E6%96%87%E4%BB%B6%E5%A4%B9%EF%BC%8C%E4%BD%A0%E4%BC%9A%E5%8F%91%E7%8E%B0%E6%98%AF%E4%B8%8B%E9%9D%A2%E7%9A%84%E6%A0%B7%E5%AD%90%EF%BC%8C%E6%88%91%E4%BB%AC%E4%BB%8A%E5%A4%A9%E8%AF%B4%E7%9A%84%E6%98%AFtomcat%E7%9A%84%E9%85%8D%E7%BD%AE%E6%96%B9%E6%B3%95}

image-1646982797556

4. 把上面文件夹的目录放到tomcat的conf目录下,如下图所示 {#4.-%E6%8A%8A%E4%B8%8A%E9%9D%A2%E6%96%87%E4%BB%B6%E5%A4%B9%E7%9A%84%E7%9B%AE%E5%BD%95%E6%94%BE%E5%88%B0tomcat%E7%9A%84conf%E7%9B%AE%E5%BD%95%E4%B8%8B%EF%BC%8C%E5%A6%82%E4%B8%8B%E5%9B%BE%E6%89%80%E7%A4%BA}

image-1646982818350
image-1646982822979

5. 然后我们需要对server.xml进行编辑 {#5.-%E7%84%B6%E5%90%8E%E6%88%91%E4%BB%AC%E9%9C%80%E8%A6%81%E5%AF%B9server.xml%E8%BF%9B%E8%A1%8C%E7%BC%96%E8%BE%91}

修改处有几点说明:

①: 访问端口更改为80。

②:redirectPort更改为443。

③:添加Https访问证书的指定位置和文件的密码。

附更改源码:

 <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="443" />

\<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="conf/Tomcat/lx95.top.jks"
keystorePass="这里是密码"  /\>

`<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="443" />
`

image-1646982857057
image-1646982863414

6.这样配置好之后重启tomcat,在你域名前面加上Https访问就可以啦~ {#6.%E8%BF%99%E6%A0%B7%E9%85%8D%E7%BD%AE%E5%A5%BD%E4%B9%8B%E5%90%8E%E9%87%8D%E5%90%AFtomcat%EF%BC%8C%E5%9C%A8%E4%BD%A0%E5%9F%9F%E5%90%8D%E5%89%8D%E9%9D%A2%E5%8A%A0%E4%B8%8Ahttps%E8%AE%BF%E9%97%AE%E5%B0%B1%E5%8F%AF%E4%BB%A5%E5%95%A6~}

有什么不懂得或者存在问题的地方请留言指正,多多完善~

赞(1)
未经允许不得转载:工具盒子 » 腾讯域名Https访问,Tomcat配置详解