LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-14-2022, 12:12 AM   #1
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,539

Rep: Reputation: 177Reputation: 177
Wordpress and Tomcat


I have Apache http and Tomcat configured on my webserver. I now want to install Wordpress. However, all URL references are currently handled by Tomcat and look for the jsp or html pages in the $CATALINA_HOME/webapps directory.

This link: https://www.linkedin.com/pulse/hosti...biswajit-paria gave some ideas on doing this. It recommended some ideas I'd rather avoid like Quercus.war. This site also said:
Quote:
The simple solution would be to setup tomcat along with LAMP (Linux, Apache, MySQL, PHP) where apache http would serve wordpress blog and proxy server, while tomcat would serve java web application.
That sounds attractive. I could install Wordpress in my Apache DocumentRoot, but I'm not sure how I can access things in the Apache DocumentRoot with Tomcat running. Could this be done with a Virtual Host entry in httpd-vhosts.conf?

Need advice.

Last edited by mfoley; 05-14-2022 at 12:14 AM.
 
Old 05-14-2022, 07:27 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Hi,

You can configure apache to use one (or more) vhost(s) to act as a reverse proxy for tomcat and another one (or more) vhost(s) to host your wordpress site(s), i.e. something like this:
Code:
<VirtualHost :80>
ServerName wp.example.com
DocumentRoot /path/to/wordpress
--Rest of directives here--
</VirtualHost>

<VirtualHost *:80>
ServerName tomcat.example.com
ProxyPass  / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
--Rest of directives here--
</VirtualHost>
Regards
 
Old 05-14-2022, 10:29 AM   #3
mfoley
Senior Member
 
Registered: Oct 2008
Location: Columbus, Ohio USA
Distribution: Slackware
Posts: 2,539

Original Poster
Rep: Reputation: 177Reputation: 177
OK, I'll play with that. What if I just deployed wordpress in the Tomcat webapps folder? Would that work? I might try that too, just to see.
 
Old 05-14-2022, 04:44 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
Originally Posted by mfoley View Post
OK, I'll play with that. What if I just deployed wordpress in the Tomcat webapps folder? Would that work? I might try that too, just to see.
I doubt it.
AFAIK tomcat can parse simple php pages, but WP apart from php uses css, js and other stuff that it could be difficult, if not impossible, to use them with tomcat.
 
Old 05-15-2022, 09:04 AM   #5
boughtonp
Senior Member
 
Registered: Feb 2007
Location: UK
Distribution: Debian
Posts: 3,574

Rep: Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534Reputation: 2534
Quote:
Originally Posted by bathory View Post
but WP apart from php uses css, js and other stuff that it could be difficult, if not impossible, to use them with tomcat.
That is nonsense.

Whilst Tomcat is primarily used to run Java servlets, it still includes a perfectly functional HTTP server (Coyote) which can and does serve any static file format you want out of the box without any extra configuration needed for common formats. There is nothing remotely difficult about serving CSS and JS with Tomcat.

(And even if this was somehow not possible, it would still be very easy to serve such files by proxying them through a servlet which generated the appropriate HTTP response.)


Quote:
AFAIK tomcat can parse simple php pages
Tomcat does not parse PHP pages. Like Apache HTTPd and other servers, it simply forwards the requests onto a PHP engine, which is what does the parsing.

In the linked example, the PHP engine is the Quercus servlet - an implementation of PHP on the JVM - which can be used with Tomcat, but is part of Caucho Resin (a different and proprietary server).

Things have possibly changed since I tried getting Quercus running, but many years back I found it not worth the effort.

Quercus is only one option of how to run PHP software via Tomcat server. Another is to use a servlet which implements the FastCGI protocol to connect to PHP-FPM. A quick search reveals jFastCGI does this, but I've never used it so no idea how well it works.

(I prefer Jetty to Tomcat, and Jetty has a built-in FastCGI servlet, which I've successfully used to run both PHP and Python software.)

However, an important thing to keep in mind is that a lot of PHP software expects Apache HTTPd and come with .htaccess files containing rewrite rules and other directives, which then need to be translated to have the software run correctly. (From memory, running Wordpress on Jetty wasn't a big deal, but some of the other CMSes I was testing were very fiddly.)


Anyhow, pairing Apache HTTPd and Tomcat is a common and well-documented process, so unless there's a specific reason to not simply setup a reverse proxy, that should probably be where the effort is focused.


Last edited by boughtonp; 05-15-2022 at 09:06 AM.
 
  


Reply

Tags
insatllation, tomcat, wordpress


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: WordPress Dashboard & Settings Page | WordPress 101 LXer Syndicated Linux News 0 12-07-2020 04:42 PM
Docker with wordpress/mysql/nginx, no styles in wordpress E-Kami Linux - Server 2 01-23-2018 02:41 PM
LXer: WordPress Plugin Tutorial — How To Install WordPress Plugins LXer Syndicated Linux News 0 12-09-2015 09:10 AM
Apache2 Configuration or Wordpress Configuration: Wordpress index.php not loading khun Linux - Newbie 5 05-18-2012 08:26 AM
how to install pre existing wordpress directory on a existing wordpress to run a web ajbardhan Linux - Software 3 04-28-2012 07:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration