Connecting Tomcat with Apache

Ondrej Kosarko edited this page Sep 21, 2016 · 3 revisions

Connecting Tomcat and Apache

There are several possibilities how to connect tomcat and apache. These include

mod_proxy (_ajp or _http) is easier to configure than mod_jk. We describe it below briefly.

Configuration with mod_proxy

In apache it's just the matter of using ProxyPass (with either ajp:// or http:// and a right port number, these depend on what you configure in tomcat). Let's use ajp. Below the minimum configuration is shown, note there will be other configuration in thath file (eg. enabling shibboleth), also you should make oai available through http, so you also need to add ProxyPass to your :80 VirthualHost.

sites-enabled/https

<VirtualHost *:443>
...
 ProxyRequests Off
 ProxyTimeout 600

 ProxyPass         / ajp://127.0.0.1:8009/
 ProxyPassReverse  / http://ufal-point-dev.ms.mff.cuni.cz/
...

In tomcat server.xml enable the AJP Connector (or HTTP Connector). Example configuration of tomcat usually has a HTTP Connector available on port 8080 and AJP on 8009. Your server.xml should contain lines simmilar to these below.

Top level server element.

<Server port="8005" shutdown="XXX">

AJP Connector listening on port 8009.

<Connector address="127.0.0.1" port="8009" protocol="AJP/1.3" enableLookups="false" URIEncoding="UTF-8" />
<Engine name="Catalina" defaultHost="localhost" jvmRoute="ajp13_worker">

Default host allows loading of webapps (manager, probe) from webapps directory (relative to CATALINA_BASE)

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

A context for each of the webapps that's part of the repository (details)

<Context path="/repository/xmlui" docBase="/xxx/dspace-1.8.2/webapps/xmlui" reloadable="true" cachingAllowed="false" allowLinking="true" />
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.