I'm going to retire an old RHEL3 server and move the services to CentOS5. In particular, the web server is giving me a headache. On the old box, there's a hacked-up httpd/mod_jk/tomcat setup, and CentOS is perfect for the new box because the required components are included and the whole setup "just works" straight from installation.
There seems to be surprisingly little documentation or how-tos on how to migrate from the above setup to httpd/mod_proxy_ajp/tomcat. I believe I have it working correctly on a test machine, but am looking for someone to look over the config to make sure it's correct and complete.
The desired setup is: - httpd receives all requests - httpd processes all requests for static content - httpd passes all requests for dynamic content to tomcat
Most examples I found seem to assume that all queries, including static, are pased on to tomcat. To implement the correct behaviour, I came up with this conf.d fragment:
<LocationMatch ".*WEB-INF.*"> AllowOverride None deny from all </LocationMatch>
<Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy>
ProxyPreserveHost on ProxyPassMatch ^(.*.jsp)$ ajp://localhost:8009/$1
The second bit was much harder to figure out - point tomcat to httpd's DocumentRoot. I came up with the following snippet: use the included /etc/tomcat/server-minimal.xml as server.xml and make the following change:
--- server-minimal.xml 2010-10-11 00:16:41.000000000 +0100 +++ server.xml 2011-03-20 01:48:12.000000000 +0000 @@ -18,7 +18,9 @@ <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" /> - <Host name="localhost" appBase="webapps" /> + <Host name="localhost" appBase="webapps"> + <Context path="" docBase="/var/www/html" reloadable="true" /> + </Host> </Engine>
</Service>
Any comments/suggestions? Would I be better of to stick with mod_jk even on CentOS?
On Sat, Mar 26, 2011 at 6:48 AM, lhecking@users.sourceforge.net wrote:
I'm going to retire an old RHEL3 server and move the services to CentOS5. In particular, the web server is giving me a headache. On the old box, there's a hacked-up httpd/mod_jk/tomcat setup, and CentOS is perfect for the new box because the required components are included and the whole setup "just works" straight from installation.
Do you need Tomcat6? It's available over at www.jpackage.org, and will be in CentOS 6. Not that this deals with your issue, but I thought you might appreciate a heads up on its availability as a more contemporary version to aim for.
Do you need Tomcat6? It's available over at www.jpackage.org, and will be in CentOS 6. Not that this deals with your issue, but I thought you might appreciate a heads up on its availability as a more contemporary version to aim for.
Thanks, Nico, I will stick with CentOS5 onboard tools for now, although the service will undoubtedly move to CentOS6 in the medium term.
lhecking@users.sourceforge.net wrote:
I'm going to retire an old RHEL3 server and move the services to CentOS5. In particular, the web server is giving me a headache. On the old box, there's a hacked-up httpd/mod_jk/tomcat setup, and CentOS is perfect for the new box because the required components are included and the whole setup "just works" straight from installation.
There seems to be surprisingly little documentation or how-tos on how to migrate from the above setup to httpd/mod_proxy_ajp/tomcat. I believe I have it working correctly on a test machine, but am looking for someone to look over the config to make sure it's correct and complete.
The desired setup is:
- httpd receives all requests
- httpd processes all requests for static content
- httpd passes all requests for dynamic content to tomcat
Most examples I found seem to assume that all queries, including static, are pased on to tomcat. To implement the correct behaviour, I came up with this conf.d fragment:
You might also want to ask this question on the Tomcat users mailing list, users-subscribe@tomcat.apache.org
I hope you'll post the outcome of your research.