Search code examples
linuxapachetomcatproxypass

How to map domain name to my Java application which runs on Tomcat server


I have installed both apache2 and tomcat7 on my ubuntu14.04 droplet. Apache is running on default port 80 and tomcat7 on 8080. I have an application deployed on tomcat and to access it, the url looks like: www.mysite.com:8080/Application_name/

But i want my application to come up when user just enters www.mysite.com

How to configure this?


Solution

  • you need to configure Apache to be a reverse-proxy from / to /application_name, this will hide the application context for the end-user.

    Enable all LoadModule for the proxy, and add

    ProxyPreserveHost On
    ProxyPass / http://localhost:8080/application_name/
    ProxyPassReverse / http://localhost:8080/application_name/