`
小斌张
  • 浏览: 87441 次
  • 性别: Icon_minigender_1
  • 来自: 河北
社区版块
存档分类
最新评论

tomcat配置http和https访问

    博客分类:
  • java
阅读更多
设置使tomcat既支持http访问,也支持https访问。需要在server.xml中进行设置
<!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"/>
    -->

将注释去掉,同时添加证书路径和证书私钥
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS"
               keystoreFile="e:\cert\tomcat.keystore"   keystorePass="p.tt.jubao110.com"/>

保存后,重启tomcat即可。

将tomcat设置成只支持https访问模式,需要在web.xml配置文件中进行处理,
    完成上面的配置后,打开web.xml文件,在文件的尾部加上
    
<security-constraint>

<web-resource-collection>

<web-resource-name >SSL</web-resource-name>
<url-pattern>/*</url-pattern>

</web-resource-collection>

<user-data-constraint>

<transport-guarantee>CONFIDENTIAL</transport-guarantee>

    </user-data-constraint> 


</security-constraint>
保存,重启tomcat,设置完成
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics