8443端口有什么用?

What is the use of port 8443?

Tomcat uses to open SSL text service. The default configuration file used in the port is 8443. The Tomcat is a core project in the Jakarta project of the Apache Software Foundation, which is developed by Apache, Sun and several other companies and individuals.

这个描述没有给出直观的描述,也没有解释为什么需要端口。

Apache Tomcat 中的端口 8443 用于 运行 您的 HTTPS 服务,它需要指定参数,如下所述。

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
        maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
        clientAuth="false" sslProtocol="TLS" />

以上代码在端口 8443 上启用了 SSL,HTTPS 的默认端口是 443,因此为避免冲突,它使用 8443 而不是 443,就像 8080 用于 HTTP 而不是 80 一样。

虽然您必须为 SSL 连接生成一个密钥库才能工作,并且需要一些额外的属性,即 keystoreFile 和 keystorePass。

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
            maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
            clientAuth="false" sslProtocol="TLS" keystoreFile="/Users/Shared/crunchify.keystore" keystorePass="123456"/>

您可以通过执行以下命令生成密钥库:

keytool -certreq -keyalg RSA -alias crunchify -file crunchify.csr -keystore crunchify.keystore

现在重新启动您的 tomcat 并使用 8443 浏览您的服务。