Apache Proxy

 

This article describes how to configure Apache HTTP server to proxy HTTP traffic to the MailArchiva web console. This method requires both AJP and Web Sockets communications. The following modules are required: mod_jk, mod_proxy and mod_proxy_wstunnel. Since Web Socket support was only added to Apache from v2.4.5 onwards, it is necessary to install/upgrade to Apache v2.4.5 or higher. An easier, alternative integration method is also available.

 

Note: The following instructions are geared for Linux Debian OS. They can be easily adapted for other platforms (e.g. Windows).

 

 

The mod_proxy and mod_proxy_wstunnel are included as part of the base Apache distribution. It may be necessary to download, compile and install the Apache mod_jk Tomcat Connector. See https://tomcat.apache.org/download-connectors.cgi for the download link.

 

To load the required modules, add the following to Apache's /etc/apache2/httpd.conf main configuration file:

 

 

LoadModule jk_module modules/mod_jk.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so

 

At the bottom of the file:

 

# include jk module
<IfModule jk_module>
Include /etc/apache2/jk.conf
</IfModule>
<IfModule proxy_wstunnel_module>
Include /etc/apache2/proxy.conf
</IfModule>

 

The jk.conf file is created when the jk_module is compiled and installed. It references a /etc/apache2/worker.properties file. Edit the file as follows:

 

# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8011

 

The mod_proxy proxy.conf (referenced by httpd.conf) file should contain the following:

 

ProxyPass /linkage ws://localhost:8090/linkage
ProxyPass /linkage wss://localhost:8090/linkage

 

Ensure the Tomcat embedded with MailArchiva has both an AJP and an HTTP connector enabled.

 

Add a new virtual host configuration and enable as follows:

 

vi /etc/apache2/sites-available/site.conf (add below content)
ln -s /etc/apache2/sites-available/site.conf /etc/apache2/sites-enabled/site.conf

 

The virtual site configuration should contain:

 

<VirtualHost *:80>

 ServerName site.com
 ServerAlias www.site.com

 JkUnMount /ws2 worker1
 JkUnMount /wss2 worker1
 SSLProxyEngine On
 ProxyPreserveHost On
 #ProxyRequests Off
 ProxyPass /wss/ wss://localhost:8090/linkage
 ProxyPass /ws/ ws://localhost:8090/linkage
 ProxyPassReverse /ws/ ws://localhost:8090/linkage
 ProxyPassReverse /wss/ wss://localhost:8090/linkage

 JkMount /site* worker1

</VirtualHost>

 

In /opt/mailarchiva/server/conf/server.xml, uncomment the following line (as necessary):

 

<Connector port="8011" protocol="AJP/1.3" redirectPort="8443" address="0.0.0.0" secretRequired="false" />

 

Restart MailArchiva. MailArchiva should be accessible at http://localhost/site

 

Set Proxy System Variable

 

Set proxy system variable to ensure that MailArchiva has visibility to the user's IP address.

 

Linux: Add -Dproxy=yes variable to CATALINA_OPTS in /opt/mailarchiva/server/startserver script

Windows: Right click tray icon, click Configure, select Java tab, In Java Options add -Dproxy=yes

 

Note: If Web Sockets is working right, after logging into the console via Apache, the charts should be moving in Status->Charts.
Was this information helpful?

Found this information useful? Visit mailarchiva.com to learn more about MailArchiva.

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please make sure you spelled the page name correctly or use the search box.