Search code examples
javawordpressapachetomcatmod-jk

Apache as proxy to WordPress and Tomcat using modjk


This is my current infrastructure. I have two VMs on GCP:

VM1 -> Apache

VM2 -> Tomcat

Tomcat VM has my web application running. All requests to my domain are directed towards Apache VM and from Apache, I redirect them to Tomcat VM using modjk. This is working perfectly fine as of now.

However, I need to host the landing page on WordPress, so that somebody else can manage the home page content, and the entire application need not be deployed when somebody identifies a typo or some contact information changes in the home page.

This is my requirement:

  1. When users type www.xyz.com they should be redirected to the WordPress managed webpage. In this web page, there is a login option in the menu. Currently, even the home page is part of the web application on Tomcat.
  2. When users click the login, that request should take the users to www.xyz.com/login which is on Tomcat VM.

I have created a new VM for WordPress, but I'm not able to figure out how to connect Apache and WordPress. This is my current modjk configuration in apache:

JKMount /* worker1
JKMount /status jkstatus

Any help would be greatly appreciated.

Thanks.


Solution

  • You're not going to be able to do this as if you did manage to configure this, what appears to be a needlessly complex setup, then the user would never be able to login to the WordPress Admin area at /wp-admin/ and subsequent pages when editing via the WP Admin area.

    If you really want to use WordPress for the 'homepage' I'm guessing that this is to provide some level of control to the user for the homepage but nothing else, then I'd suggest one of two options;

    1) Use www.website.com which is all under WordPress, then use sub-domain.webiste.com which is all powered with your Java application.

    2) Host wordpress.website.com, then use the WordPress REST API to pull in data dynamically to your Java application so that the entire of www.website.com is running from your Java application.

    I can't see a valid reason to use the needlessly complex setup that you've described, I'd suggest re-designing your architecture....your future self will thank you for it :-)