问题
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
I have a domain at say, my.domain.com
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>
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
HostName
With my current settings above i'm am not getting any results in seeing my webapp online. Any thoughts would be very grateful!
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
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!
回答1:
Your /etc/hosts should contain an entry like this:
123.123.123.33 my.domain.com
or
123.123.123.33 HostName.my.domaing.com HostName my.domain.com
Otherwise you won't be able to resolve the name my.domain.com to connect to your Tomcat.
回答2:
If you already configured your firewall earlier, to redirect ports you type
sudo firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080 --permanent
and reboot it.
来源:https://stackoverflow.com/questions/28647846/how-to-map-tomcat-7-webapp-to-my-domain