HOWTO run Wordpress site along with Tomcat web aplication on the same server
Solution 1
Taking @lain's direction I was able to finally resolve the issue by doing couple of things.
- Renamed the WAR file in my tomcat, in this case private-pages
- In my virtual hosts definition I changed ajp:// to reflect the above change.
Here is virtual hosts file,
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
ServerName localhost:443
DocumentRoot /var/www
<Directory /var/www>
#For Wordpress
Options FollowSymLinks
AllowOverride All
</Directory>
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPreserveHost On
ProxyRequests Off
ProxyPass /private-pages ajp://localhost:8009/private-pages
ProxyPassReverse /private-pages ajp://localhost:8009/private-pages
<Location /private-pages>
Order allow,deny
Allow from all
</Location>
SSLEngine on
SSLProxyEngine On
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
</VirtualHost>
Solution 2
I think the technology you are looking for is a reverse proxy. Configure your tomcat to listen on 8080 and have apache act as a proxy for it using mod_proxy_ajp or similar.
Solution 3
I recently put all together with Quercus (a PHP5 java implementation) building up a single WAR file with the latest wordpress.
Related videos on Youtube
Chantz
Updated on September 18, 2022Comments
-
Chantz over 1 year
I am building a solution where the CMS part of the site (i.e. About US, Contact etc) will be run on Wordpress & the private pages will be a Java-Servlet based stack run on Tomcat 7.
Both of these "apps" have to run on the same server for budget reasons, at least for now.
What I want to know how to make this happen (via configurations, setups etc)? So that whenever users come to public pages they will be served content from Wordpress but for private pages (here I am assuming there will be a URL pattern differentiating this) then it will be served by Tomcat
I am assuming here that I will be using Apache as the server for fronting the wordpress requests. Also it is an Ubuntu 12.04 server.
-
LinuxDevOps almost 10 yearsNot sure what the problem is, you can use different port, different ip or a subdomain (cleanest option imho) to differentiate private service.
-
Chantz almost 10 years@LinuxDevOps If I use different port, then how to make sure that the port number does not show up in the URL? Subdomain looks like a good solution, but then will I have to buy SSL certificates for both main & sub-domain?
-
-
natxo asenjo almost 10 years+1 we use mod_proxy for this stuff
-
Chantz almost 10 years@lain I tried using mod_proxy_ajp, but it seems that only the HTML is being returned, but all the static assets within it are not getting loaded & returning 404. Here is the vhosts file I have gist.github.com/tankchintan/d8e94f9c0ed983f689cc The path of those static assets uses the original address which is port 80.
-
user9517 almost 10 yearsNow that you know the technology to use it's your job as a sysadmin to figure out how to make it work surely ?
-
Chantz almost 10 yearsI was missing the renaming of my war file, to match the context & then updating the context in the ajp:// path. Thanks for helping along! Appreciate it.