Link to home
Start Free TrialLog in
Avatar of Mark
Mark

asked on

How to set default webapp for host

I am using Apache Tomcat 8.0.15 on Linux Slackware 14.1. I have a server with multiple URLs. In $CATALINA_HOME/webapps I have separate app directories corresponding to each of these URLs.

How to I configure things so that a user just has to type the URL and gets the right app? For example:

enter: http://www.mydomain.comĀ  ---- instead of: http://www.mydomain.com/thisApp
Avatar of Am P
Am P
Flag of India image

Give it a try by following:

1. Stop your tomcat.
2. Place your war file outside of CATALINA_BASE/webapps. And remove the applications/war from CATALINA_BASE/webapps.
3. Create a file called ROOT.xml and place it in CATALINA_BASE/conf/. The one and only element (Context) in this context file must have a docBase attribute pointing to the location of your war file. The path element should not be set - it is derived from the name of the .xml file, in this case ROOT.xml.
4. Start your tomcat.
SOLUTION
Avatar of Am P
Am P
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark
Mark

ASKER

I'm not using WARs at the moment. I have several folder under $CATALINA_HOME/webapps:

thisgroup/
thatgroup/
anothergroup/

For each of these I have a corresponding public domain/URL

http://www.thisgroup.org
http://www.thatgroup.org
http://www.anthergroup.org

I'm also using Apache httpd, and have the following httpd-tomcat.conf
# Load mod_jk module
LoadModule    jk_module  lib64/httpd/modules/mod_jk.so

# Where to find workers.properties
JkWorkersFile /etc/httpd/workers.properties

# Where to put jk shared memory
JkShmFile     /var/log/httpd/mod_jk.shm

# Where to put jk logs
JkLogFile     /var/log/httpd/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel    info

# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

# Send everything for context /examples to worker named worker1 (ajp13)

JkMount  /thisgroup/* worker1
JkMount  /thisgroup worker1

JkMount  /thatgroup/* worker2
JkMount  /thatgroup worker2

Open in new window

What would I do in this configuration? Some change to httpd.conf? Something in web.xml, server.xml? I thought I'd figured this out once, but apparently can't remember.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mark

ASKER

The contributors didn't really solve my problem as their answers did not apply. I guess I solved my own problem but can't say how.