如何将 tomcat 7 webapp 映射到我的域 [英] How to map tomcat 7 webapp to my domain
问题描述
我知道已经通过多种方式触及了这一点,但我仍然遇到问题 - 我有一个 web 应用程序:
I know this has been touched upon in several ways already, but i'm still having issues - I have a webapp in:
/var/lib/tomcat7/webapps/abc.war
/var/lib/tomcat7/webapps/abc.war
我有一个域名,例如 my.domain.com
I have a domain at say, my.domain.com
我已将此添加到我的 conf/server.xml(我认为设置正确?)Docbase 指向 war 文件夹?
I've added this to my conf/server.xml (which i believe is set correctly?) Docbase points to the war folder?
<Host name="my.domain.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context path="" docBase="/abc" debug="0" privileged="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false" />
</Host>
我的域 ip 与本地主机 ip 一起位于/etc/hosts 中:
My domain ip is in the /etc/hosts along w/ the local host ip:
127.0.0.1 localhost
123.123.123.33 HostName.my.domaing.com HostName
$/etc/hostnames
$ /etc/hostnames
HostName
使用上述当前设置,我无法在线查看我的 web 应用程序.任何想法将不胜感激!
With my current settings above i'm am not getting any results in seeing my webapp online. Any thoughts would be very grateful!
我的域也已经映射到我的/var/www/html 目录.我可以在线查看我的临时 index.html 文件.我的 tomcat webapp 通过 ip:8080/abc 工作正常
My domain already is mapped to my /var/www/html directory too. I can see my temp index.html file online. My tomcat webapp works fine through ip:8080/abc
我正在使用 Ubuntu Server 14.04 - Apache2这是我第一次使用 tomcat 工作,这有点令人困惑.谢谢!
I'm working on Ubuntu Server 14.04 - Apache2 This is my first time working w/ tomcat and it's a bit confusing. Thank You!
推荐答案
你的/etc/hosts 应该包含这样的条目:
Your /etc/hosts should contain an entry like this:
123.123.123.33 my.domain.com
123.123.123.33 my.domain.com
或
123.123.123.33 HostName.my.domaing.com HostName my.domain.com
123.123.123.33 HostName.my.domaing.com HostName my.domain.com
否则您将无法解析名称 my.domain.com 以连接到您的 Tomcat.
Otherwise you won't be able to resolve the name my.domain.com to connect to your Tomcat.
这篇关于如何将 tomcat 7 webapp 映射到我的域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!