配置tomcat7的https证书
作者:互联网
配置pfx证书
server.xml
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true" enablelookups="false" disableUploadTimeout="true" acceptCunt="100" maxhttpHeaderSize="8192" minSpareThreads="25" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreType="PKCS12" keystoreFile="cert\5808785__meescc.cn.pfx" keystorePass="0A1y311U" />
注意:对于启用APR情况下protocol不能使用HTTP/1.1,否则会报异常:java.lang.Exception: Connector attribute SSLCertificateFile must be defined when using SSL with APR。
http自动转https访问
web.xml
在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>
标签:xml,HTTP,证书,APR,tomcat7,SSL,https 来源: https://www.cnblogs.com/shichq/p/16363133.html