公司买了一个SSL证书,将网站配置成了https访问的形式,可是http访问却访问不到了,应用服务器采用的是tomcat,请问怎么配置可以实现访问http时自动跳转到https的形式呢?
试试这个
tomcat8 ①conf/server.xml
<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="443" />
②之后在conf/web.xml的最下面</web-app>前加上
<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
ngnix可以配置
试试这个
tomcat8
①conf/server.xml
②之后在conf/web.xml的最下面</web-app>前加上
③重启tomcat
ngnix可以配置