<!—
Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation
-->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Documents and Settings\Administrator\.keystore"
keystorePass="SUNCHIS"
ciphers="sunchis"
/>
Tomcat既可以作为独立的Servlet容器,也可以作为其他HTTP服务器附加的Servlet容器。如果Tomcat在非独立模式下工作,通常不必配置SSL,由它从属的HTTP服务器来实现和客户的SSL通信。Tomcat和HTTP服务器之间的通信无须采用加密机制,HTTP服务器将解密后的数据传给Tomcat,并把Tomcat发来的数据加密后传给客户。
以上命令将在操作系统的用户目录下生成名为“.keystore”的文件。我当前登录到操作系统的用户名是Administrator,那么在Wnidows下,文件的位置为:
C:\Documents and Settings\Administrator\.keystore
另外,如果希望生成的keystore文件存放在其他目录中,可以再keytool命令中加入-keystore参数,这个参数用来指定keystore文件的存放位置,例如以下命令将在D:\下生成名为“sunchis.keystore”的文件:
<!—
Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation
-->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="C:\Documents and Settings\Administrator\.keystore"
keystorePass="SUNCHIS"
ciphers="sunchis"
/>
实际上,基于SSL的HTTPS使用的默认端口是443。但Tomcat在这里将HTTPS端口设置为8443。<Connector>配置里的一些属性参数如下: