gpt4 book ai didi

tomcat - 转发 CNAME 到 Tomcat

转载 作者:行者123 更新时间:2023-11-28 22:30:11 25 4
gpt4 key购买 nike

我有一个带有 DIY 插件的 OpenShift 实例,我在其中亲自配置了 Apache Tomcat。这是我的 server.xml:

<?xml version='1.0' encoding='utf-8'?>
<Server port="15005" shutdown="SHUTDOWN" address="OPENSHIFT_DEV_IP">

<Listener className="org.apache.catalina.security.SecurityListener" />
<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" />

<GlobalNamingResources>
<Resource name="jdbc_ttDS" auth="Container"
type="javax.sql.DataSource"
driverClassName="org.h2.Driver"
url="jdbc:h2:ssutt;INIT=RUNSCRIPT FROM './initTT.sql'"

username="####"
password="####"
maxActive="20"
maxIdle="5"
maxWait="-1"
description="SSU TT database"
/>

<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

<Service name="Catalina">


<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
address="OPENSHIFT_DEV_IP"
redirectPort="15443" />
<Connector port="15009" protocol="AJP/1.3" redirectPort="8443" address="OPENSHIFT_DEV_IP"/>


<Engine name="Catalina" defaultHost="OPENSHIFT_DEV_IP">

<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase"/>
</Realm>

<Host name="backend-ssutt.rhcloud.com" appBase="webapps"
unpackWARs="true" autoDeploy="true">

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t &quot;%r&quot; %s %b" />

</Host>

</Engine>
</Service>
</Server>

我可以通过 backend-ssutt.rhcloud.com 访问它。没关系。奇怪的是,我无法通过其他地址(如 api.ssutt.org)访问它,但是我添加了别名(例如别名)和 DNS CNAME 记录。

奇怪的是,它在默认的 Tomcat 7/EWS 卡式盒上工作。如何将 Tomcat 或我的 DNS 记录配置为可通过其他地址访问。

最佳答案

通过在 Tomcat 配置中添加 Alias 解决了这个问题。 Official documentation

关于tomcat - 转发 CNAME 到 Tomcat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22801992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com