我在Apache Tomcat 7 Web服务器上为端口8443启用了连接器。但是,当我尝试在8443上访问已部署的应用程序(https:// myserver:8443 / myapplication /)或tomcat管理器时,页面无法解析。我想知道我是否错过了一步? Tomcat启动时没有任何错误或警告。这是我所做的更改:
在防火墙上允许使用端口8443,并在server.xml中取消对8443连接器的注释:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/var/lib/tomcat7/localhost.jks"
keystorePass="mypassword" keyAlias="localhost" />
我在catalina.sh中添加了以下内容:
JAVA_OPTS =“ $ JAVA_OPTS -Djavax.net.ssl.trustStore = / var / lib / tomcat7 / localhost.jks -Djavax.net.ssl.keyStore = / var / lib / tomcat7 / localhost.jks -Djavax.net.ssl。 keyStorePassword = mypassword -Djavax.net.ssl.trustStorePassword = mypassword“
最后,我重新启动了Tomcat:
Nov 9, 2012 10:51:44 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 9, 2012 10:51:44 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8443"]
Nov 9, 2012 10:51:44 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 574 ms
Nov 9, 2012 10:51:44 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Nov 9, 2012 10:51:44 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Nov 9, 2012 10:51:44 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/myapplication.war
Nov 9, 2012 10:51:45 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Nov 9, 2012 10:51:57 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'grails'
Nov 9, 2012 10:51:57 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Nov 9, 2012 10:51:57 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 9, 2012 10:51:57 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8443"]
Nov 9, 2012 10:51:57 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 13439 ms
如您所见,它为8443启动了ProtocolHandler。
我是否需要将证书的别名更改为真实服务器名称而不是localhost?那是我唯一能想到的。还有其他想法吗?
这是端口8443的nmap:
$nmap -p 8443 localhost
Starting Nmap 5.21 ( http://nmap.org ) at 2012-11-10 02:47 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000091s latency).
rDNS record for 127.0.0.1: localhost.localdomain
PORT STATE SERVICE
8443/tcp open https-alt
Nmap done: 1 IP address (1 host up) scanned in 0.06 seconds
谢谢!
将Djavax.net.debug = all添加到catalina.sh之后的Catalina.out:
...
Nov 11, 2012 4:24:36 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'grails'
Nov 11, 2012 4:24:36 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Nov 11, 2012 4:24:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 11, 2012 4:24:37 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8443"]
Allow unsafe renegotiation: false
Allow legacy hello messages: true
Is initial handshake: true
Is secure renegotiation: false
http-bio-8443-Acceptor-0, called closeSocket()
Nov 11, 2012 4:24:37 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 13399 ms
最佳答案
好吧,我很尴尬。事实证明,如果我导航到实际的IP地址,那么它将起作用(与域名相对)。似乎我需要在某处提供映射(有人知道在哪里吗?),以便使用域名解析...。
关于apache - 无法在Apache Tomcat 7上启用8443,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13318758/