I want to have a web-server running on port 80. Everywhere I read, Apache Tomcat runs on 8080. Who wants to have that in their URL? So my first question is where do I cahnge the port number? Do I change it in a single location?
I am used to apache2 virtual hosting. I would like the same setup on tomcat. A folder belongs to each website. I have figured out how to create virtual hosting with servers.xml
and have multiple folders for each site but I can not figure out how to deploy a war file to the root directory of each virtual host.
When the war file is deployed, there is a second.war
file and there is a blank dir called second
. When I go to see the site I have to go to http://example.com:8080/second to see it. I don't want to have to type in second
in the URL. How can I resolve this? I am not a java programmer and the guy who is compiling the Java is a beginner JSP developer.
Here is my Host in servers.xml
:
<Host name="example.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Alias>www.example2.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="example_com_app_access_log" suffix=".txt"
pattern="%h %l %u %t %r %s %b" />
<Context path="" docBase="/opt/tomcat/webapps/example_com"
debug="0" reloadable="true"/>
</Host>
Scary Wombat had the answer in the comments. Setup a reverse proxy with Apache and it works great!