控制台 -> 产品与服务 -> 证书服务 -> 绑定域名 -> (默认项)补全信息 -> 提交审核 -> 查看进度 -> 颁发证书 -> 下载证书
<b>在官方安装证书教程之外的注意点:</b>
- 将server.xml的如下代码的注释去掉
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
修改为:
<Connector port="443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="cert/xxx.jks"
keystorePass="password"/>
a、在64位系统下,上面的protocol=”HTTP/1.1” 需要修改为
“org.apache.coyote.http11.Http11Protocol”,tomcat才能启动成功
b、port="8443"改为了443,是为了不输入端口号即可访问,因为https默认443。为了达到目的,还需改两处地方:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
将以上两个标签里的redirectPort="8443"改为redirectPort="443"
<b>注意要将443端口开放:</b>
此时,重启tomcat后应该就可以按https:// domain访问了
- 如何将输入的http:// 强制跳转到https:// 服务
在项目的web.xml里加上:
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<login-config>
<!-- Authorization setting for SSL -->
<auth-method>CLIENT-CERT</auth-method>
<realm-name>Client Cert Users-only Area</realm-name>
</login-config>
<security-constraint>
<!-- Authorization setting for SSL -->
<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应该就可以了