mehran
mehran

Reputation: 53

how to use different subdomains on same java webapp

I want to map different paths on a java webapp to different subdomains with tomcat7.

like: sub1.domain.com <- domain.com/sub1/
sub2.domain.com <- domain.com/sub2/..

I found some solutions with different java webapp but I didn't find anything for mapping folders to subdomains.

Upvotes: 2

Views: 272

Answers (1)

Ren&#233; Link
Ren&#233; Link

Reputation: 51353

You can achieve different subdomains by enable tomcat's ajp connector and use an apache server with mod_jk in front of the tomcat. In the apache server configuration you can create virtual hosts and use the JkMount directive to mount your webapp.

Inside the virtualHost Directive:

JkMount URL_PREFIX WORKER_NAME
e.g.
JkMount /sub1 sub1worker

And update the workers.properties file

worker.list=sub1Worker,sub2worker

worker.sub1worker.type=ajp
worker.sub1worker.host=yourtomcathost.com
worker.sub1worker.port=8009 # default port

Upvotes: 1

Related Questions