tomcat配置https协议

一.配置https协议

1.创建证书

使用JDK自带工具keytool

在cmd命令行中输入以下命令,keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore "d:\apache-tomcat-8.0.15.keystore"(为存储路径,要与本地tomcat路径一致)

设置密码并输入相应信息

 2.配置HTTPS协议

在D:\apache-tomcat-8.0.15\conf路径下,找到server.xml文件

找到对应代码去掉注释,添加刚获得的证书路径及密码(https端口为8443)

keystoreFile="D:\apache-tomcat-8.0.15.keystore"  
keystorePass="123456"

3.启动Tomcat服务,在浏览器中输入https://localhost:8443(或管理地址https://localhost:8443/manager/html)

二.tomcat日志级别

SEVERE(highest) Captures exception and Error捕获异常和错误

WARNING Warning messages警告消息

INFO Informational message, related to the server activity与服务器活动相关的信息性消息

CONFIG Configuration message配置信息

FINE Detailed activity of the server transaction (similar to debug)服务器事务的详细活动(类似于调试)

FINER More detailed logs than FINE更详细的日志

FINEST(least) Entire flow of events (similar to trace)整个事件流(类似于跟踪)

三.配置用户

role(角色/权限)和user(用户)即可。一个user节点表示单个用户,属性usernamepassword分别表示登录的用户名和密码,属性roles表示该用户所具备的权限

在conf文件夹下的tomcat-users.xml中配置用户

 

admin-gui — 可访问 "host管理" 页面,但"APP管理" 和 "服务器状态" 页面无查看权限
manager-gui — 无 "host管理" 页面访问权限,有"APP管理" 和 "服务器状态" 页面查看权限
manager-status — 只有"服务器状态" 页面查看权限
manager-script — 有脚本方式管理接口访问权限和"服务器状态" 页面查看权限
manager-jmx — JMX 代理接口访问权限和"服务器状态" 页面查看权限
admin-script — 只有host-manager脚本方式管理接口访问权限

原文地址:https://www.cnblogs.com/tinkerbell/p/11718853.html