Third-party software integration: Apache

From OpenKM Documentation
Revision as of 10:45, 25 January 2010 by Pavila (talk | contribs)

Jump to: navigation, search

Expose OpenKM directly from JBoss can be dangerous if you need the application to be accessed from Internet. Also this 8080 may be closed by a firewall. For these reasons, is a good idea expose your OpenKM installation through the standard web port 80. In the following steps we explain how to configure Apache to handle these request and forward to JBoss application server using the AJP13 protocol.

From the Apache documentation: The AJP13 protocol is packet-oriented. A binary format was presumably chosen over the more readable plain text for reasons of performance. The web server communicates with the servlet container over TCP connections. To cut down on the expensive process of socket creation, the web server will attempt to maintain persistent TCP connections to the servlet container, and to reuse a connection for multiple request/response cycles.

The first thing in to install the required Apache software. From Debian / Ubuntu you can install Apache with a single command:

$ sudo aptitude install apache2

Edit the file called /etc/apache2/apache2.conf and configure a ServerName to prevent warnings in the Apache startup process:

ServerRoot "/etc/apache2"
ServerName "your-domain.com"

Enable the proxy module, needed to forward petitions to JBoss:

$ sudo a2enmod proxy_ajp

Now create the configuration file /etc/apache2/sites-available/openkm.cfg with this content:

<VirtualHost *>
    ServerName openkm.your-domain.com
    RedirectMatch ^/$ /OpenKM
    <Location /OpenKM>
        ProxyPass ajp://127.0.0.1:8009/OpenKM
        ProxyPassReverse http://openkm.your-domain.com/OpenKM
    </Location>
    CustomLog /var/log/apache2/openkm-access.log combined
</VirtualHost>

The VirtualHost ServerName must be other than ServerName in the main Apache configuration. Enable this site configuration:

$ sudo a2ensite openkm.cfg

You have to enable explicity the proxy access editing the Apache configuration file /etc/apache2/mods-available/proxy.conf:

<Proxy *>
    AddDefaultCharset off
    Order deny,allow
    Allow from all
    Deny from all
    #Allow from .example.com
</Proxy>

Finally restart Apache:

$ sudo /etc/init.d/apache2 restart

Now you can access your OpenKM installation from http://openkm.your-domain.com/. Another advantage of using Apache is that you can log OpenKM access and generate web statistics.

For more info, visit: