jetty maven https(SSL)配置

1.生成keystore
keytool -genkey -keystore "D:\cas\4.2\tlk_tomcat.keystore" -alias tlkTomcat -keyalg RSA
密钥库口令和密钥密码我设置的tlktest,一会maven pom.xml配置需要使用

2.配置pox.xml
<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.16.v20140903</version>
    <configuration>
        <stopPort>9966</stopPort>
        <stopKey>foo</stopKey>
        <scanIntervalSeconds>5</scanIntervalSeconds>
        <webApp>
            <contextPath>/</contextPath>
        </webApp>
        <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <port>8080</port>
                <maxIdleTime>60000</maxIdleTime>
            </connector>
            <connector implementation="org.eclipse.jetty.server.ssl.SslSelectChannelConnector">
                <port>8443</port>
                <password>tlktest</password>
                <keystore>D:/cas/4.2/tlk_tomcat.keystore</keystore>
            </connector>
        </connectors>
    </configuration>
</plugin>

3.启动项目 jetty:run,然后访问https://ip:8443/项目名即可

猜你喜欢

转载自blog.csdn.net/tlk20071/article/details/78322553