使用HTTPS协议
程序员文章站
2022-06-22 12:29:19
...
1) 生成证书
2A) Tomcat7.x
%CATALINA_HOME%/conf/server.xml
2B) Jetty嵌入式容器 (maven plugin)
keytool -genkey -alias ying -keyalg RSA -validity 3650
2A) Tomcat7.x
%CATALINA_HOME%/conf/server.xml
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystorePass="yingzhor@163.com" />
2B) Jetty嵌入式容器 (maven plugin)
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> <configuration> <scanIntervalSeconds>20</scanIntervalSeconds> <stopKey>foo</stopKey> <stopPort>9999</stopPort> <connectors> <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> <port>8080</port> <maxIdleTime>60000</maxIdleTime> </connector> <connector implementation="org.mortbay.jetty.security.SslSocketConnector"> <port>8443</port> <maxIdleTime>60000</maxIdleTime> <keystore>C:/Documents and Settings/zhuoying/.keystore</keystore> <password>yingzhor@163.com</password> <keyPassword>yingzhor@163.com</keyPassword> </connector> </connectors> </configuration> <executions> <execution> <id>start-jetty</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <scanIntervalSeconds>0</scanIntervalSeconds> <daemon>true</daemon> </configuration> </execution> <execution> <id>stop-jetty</id> <phase>post-integration-test</phase> <goals> <goal>stop</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-sslengine</artifactId> <version>6.1.26</version> </dependency> </dependencies> </plugin>
上一篇: tomcat配置https协义
推荐阅读