配置 apache 以将域指向 tomcat webapps root

Configure apache to point domain to tomcat webapps root

我有一个基于 Java 的 Web 应用程序,使用 tomcat8 和 apache2。如果我通过 IP 地址访问我的网站,它会显示位于 /opt/tomcat/webapps 中的应用程序。但是,如果我尝试通过它的域名访问我的网站,它会将我定向到位于 /var/www/html/index.html 中的默认 apache2 页面(这并不奇怪,因为 DocumentRoot 设置为 /var/www/html我的 VirtualHost,见下文)。

指向 tomcat webapps 根目录的正确方法是什么?我需要使用 JkMount 吗?

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

我通过在 Apache 中配置反向代理来为我的 tomcat 应用程序提供服务解决了这个问题。 https://wiki.apache.org/httpd/TomcatReverseProxy