如何在https上运行IntelliJ tomcat服务器?

问题描述

我需要使用仅允许https连接的Okta SSO进行测试,所以如何在https上运行IntelliJ tomcat服务器?

我已按照以下说明在c驱动器tomcat服务器上配置了以下内容,但不知道如何在intellij tomcat服务器上设置ssl?

完成-

先决条件:


1)已安装JDK + JAVA_HOME环境变量设置

  1. Tomcat 8.0存档文件

现在打开cmd: 运行以下命令:

cd %JAVA_HOME%/bin

第1步:生成密钥库文件:.keystore


keytool -genkey -alias tomcat -keyalg RSA

并保存输入的密码:password1


步骤2:现在,我们将配置tomcat以使用密钥库文件和-SSL config


->现在打开server.xml文件并替换以下内容

<Connector SSLEnabled="true" acceptCount="100" clientAuth="false"
    disableuploadTimeout="true" enableLookups="false" maxThreads="25"
    port="8443" keystoreFile="C:\Users\Selva\.keystore" 
    keystorePass="password"
    protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https"
    secure="true" sslProtocol="TLS" />

第3步:现在,我们将配置我们的网络应用以在 https。


->打开Web应用程序的web.xml。

<security-constraint>
    <web-resource-collection>
        <web-resource-name>securedapp</web-resource-name>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

第4步:试运行

解决方法

确保正确指定了keystoreFile="/Users/.keystore",请参见Tomcat Troubleshooting部分:

默认情况下,Tomcat期望在运行Tomcat的用户主目录中将密钥库文件命名为.keystore(可能与您的目录相同:-)。如果密钥库文件在其他任何位置,则需要在Tomcat配置文件中的keystoreFile元素中添加一个<Connector>属性。