生成keystore
通过jdk工具生成tomcat.keystore,生成位置为 tomcat 根目录
keytool -genkey -alias tomcat -keyalg RSA -validity 36500 -keystore /usr/local/apache-tomcat-8.0.32/tomcat.keystore -keysize 2048
配置tomcat配置
编辑 tomcat 配置文件,/usr/local/apache-tomcat-8.0.32/conf 目录下的 server.xml 文
件,修改 http 端口为 80,https 端口为 443,并且添加证书路径及用户名和密码:
keystoreFile="/usr/local/apache-tomcat-8.0.32/tomcat.keystore"
keystorePass="123456"
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" />
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/usr/local/apache-tomcat-8.0.32/tomcat.keystore"
keystorePass="123456"
/>
启动tomcat
网友评论