我有大约 100 个 Railo 虚拟主机无法再启动。起初,新网站都有这种行为,现在它们都出现了。所有虚拟别名都打开 railo 默认上下文!这曾经有效。我的 conf/Catalina/www.example.com/ROOT.xml 文件都是这样的:
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="/www/example/site">
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
我的server.xml
;我尝试禁用 mod_cfml,但这似乎使事情变得更糟(没有网站加载):
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<Service name="Catalina">
<Connector port="8888" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
<Engine name="Catalina" defaultHost="127.0.0.1">
<Host name="127.0.0.1" appBase="webapps"
unpackWARs="false" autoDeploy="false">
<!--
<Valve className="mod_cfml.core"
loggingEnabled="true"
waitForContext="20"
maxContexts="200"
timeBetweenContexts="30000"
/>
-->
</Host>
</Engine>
</Service>
</Server>
当服务器启动时,仅部署“localhost”上下文:
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/i386:/lib:/usr/lib
Jun 11, 2015 6:24:29 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8888"]
Jun 11, 2015 6:24:29 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 11, 2015 6:24:29 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 813 ms
Jun 11, 2015 6:24:29 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 11, 2015 6:24:29 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Jun 11, 2015 6:24:29 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /opt/railo4/tomcat/webapps/ROOT
Jun 11, 2015 6:24:46 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [4,498] milliseconds.
railo-server-root:/opt/railo4/lib/railo-server
===================================================================
SERVER CONTEXT
-------------------------------------------------------------------
- config:/opt/railo4/lib/railo-server/context
- loader-version:4.3
===================================================================
Thu Jun 11 18:24:47 EST 2015-653 using JRE Date Library
Thu Jun 11 18:24:48 EST 2015-640 Start CFML Controller
Thu Jun 11 18:24:48 EST 2015 Loaded Railo Version 4.2.1.000
===================================================================
WEB CONTEXT (31c16faa5d8574b34b11678a3cb74b43)
-------------------------------------------------------------------
- config:/opt/railo4/tomcat/webapps/ROOT/WEB-INF/railo
- webroot:/opt/railo4/tomcat/webapps/ROOT/
- hash:31c16faa5d8574b34b11678a3cb74b43
- label:31c16faa5d8574b34b11678a3cb74b43
===================================================================
Jun 11, 2015 6:24:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /opt/railo4/tomcat/webapps/ROOT has finished in 19,750 ms
Jun 11, 2015 6:24:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8888"]
Jun 11, 2015 6:24:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 11, 2015 6:24:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19795 ms
尽管我使用了 apache 的 AJP 连接器,但即使我直接转到,此行为仍然存在example.com:8888
。有什么想法可能导致 Tomcat 基本上忽略我的虚拟主机?
顺便说一句:将主机添加到是可行的server.xml
,但有人告诉我这是一个坏主意,而且我不想这样做,因为我需要在不重新启动服务器的情况下部署站点:
<Host name="example.com" appBase="webapps">
<Context path="" docBase="/www/example/site" />
<Alias>*.example.com</Alias>
</Host>
我能看到的唯一真正区别是我的外部 ROOT.xml 文件没有声明appBase
或path
。它们应该声明吗?我认为 ROOT.xml 中甚至没有任何地方可以放置 appBase。
编辑:我必须更正最后一部分。应用程序已部署(在我删除其 WEB-INF 之后),但当我访问端口 80 或 8888 上的 URL 时,服务器仍然显示错误的站点。