Hyrax - Apache Integration: Difference between revisions
(→Why) |
(→Why) |
||
Line 29: | Line 29: | ||
NB: It's possible to embed these in a ''VirtualHost'' directive. | NB: It's possible to embed these in a ''VirtualHost'' directive. | ||
== | == How == | ||
ProxyPass and ProxyPassReverse are classic reverse proxy directives used to forward the stream to another location. | ProxyPass and ProxyPassReverse are classic reverse proxy directives used to forward the stream to another location. | ||
''ajp://...'' is the AJP connector location (your tomcat's server host/port) | ''ajp://...'' is the AJP connector location (your tomcat's server host/port) | ||
A web client will connect through HTTP to ''<nowiki>http://localhost/</nowiki>'' (supposing your apache2 server is running on localhost), the ''mod_proxy_ajp'' will forward you request transparently using the AJP protocol to the tomcat application server on localhost:8009. | A web client will connect through HTTP to ''<nowiki>http://localhost/</nowiki>'' (supposing your apache2 server is running on localhost), the ''mod_proxy_ajp'' will forward you request transparently using the AJP protocol to the tomcat application server on localhost:8009. |
Revision as of 21:37, 6 November 2011
Overview
The problem of linking Tomcat with Apache has been greatly reduced as of Apache 2.2. In previous incarnations of Apache & Tomcat, it was fairly complex. To see how to solve the problem for older versions of Apace, see the old Apache Integration instructions. What follows are the instructions for Apache 2.2 and Tomcat 6.x.
Prerequisites
- Apace 2.2 or greater
- Tomcat 6.x or greater
- mod_proxy_ajp installed in Apache (typically this is present in 2.2+)
What
Tomcat
You have to create the AJP connector in the conf/server.xml file:
<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
This line will enable AJP connections to the 8009 port of your tomcat server (localhost for example).
Apache
Add this to Apache's httpd.conf file:
<Proxy *> AddDefaultCharset Off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:8009/ ProxyPassReverse / ajp://localhost:8009/
NB: It's possible to embed these in a VirtualHost directive.
How
ProxyPass and ProxyPassReverse are classic reverse proxy directives used to forward the stream to another location. ajp://... is the AJP connector location (your tomcat's server host/port)
A web client will connect through HTTP to http://localhost/ (supposing your apache2 server is running on localhost), the mod_proxy_ajp will forward you request transparently using the AJP protocol to the tomcat application server on localhost:8009.