Search code examples
javaapache2tomcat8

Configure apache to point domain to tomcat webapps root


I've a Java based web application using tomcat8 and apache2. If I access my website via an ip address it displays the application located in /opt/tomcat/webapps. If however I try and access my website via it's domain name it directs me to the default apache2 page located in /var/www/html/index.html ( which is not surprising since the DocumentRoot is set to /var/www/html in my VirtualHost, see below).

What's the correct way to point to the tomcat webapps root directory? Do I need to use JkMount?

<IfModule mod_ssl.c>
    <VirtualHost _default_:443>
            ServerAdmin webmaster@localhost
            ServerName mywebsite.com
            DocumentRoot /var/www/html

Solution

  • I resolved this by configuring a reverse proxy in Apache to serve my tomcat application. https://wiki.apache.org/httpd/TomcatReverseProxy