ParaViewWeb with Apache as front-end

From KitwarePublic
Jump to navigationJump to search



ParaViewWeb is a Web application written in Java that requires a Java based web server such as Tomcat or Jetty. Those servers tends to run on high port number such as 8080 or 9000 and if they are started from a regular user, they have not the right to listen on port 80 like the default HTTP usage expect. Moreover, if you want to integrate ParaViewWeb inside another web content that is served by another server technology such as Ruby, Python or PHP, you will need an Apache server on the front of all your servers to dispatch all the client requests to the proper server.

This wiki page explain how to setup a virtual host in between Tomcat and Apache2 inside an Ubuntu. For other systems, the paths may slightly vary, but the logic should be pretty close. In order to allow better performance and streaming in image delivery, we use the ajp protocol, otherwise the default http protocol can work but will prevent the Java renderer from working due to data streaming issue.


Enable required modules

Those command lines needs to be executed as root.

 a2enmod proxy
 a2enmod proxy-ajp
 a2enmod proxy-http

Define a new Virtual host

Create a new file /etc/apache2/sites-available/paraviewweb

Using AJP protocol to allow streaming to work properly

<VirtualHost *:80>
  ProxyPass        /   ajp://localhost:8009/
  ProxyPassReverse /   ajp://localhost:8009/

Using HTTP protocol will prevent Java renderer from working

<VirtualHost *:80>
  ProxyPass        /   http://localhost:8081/
  ProxyPassReverse /   http://localhost:8081/

Enable Virtual host

This command line needs to be executed as root.

 a2ensite paraviewweb

Restart Apache

This command line needs to be executed as root.

 /etc/init.d/apache2 restart


In that case we supposed that tomcat has been download and installed in a user home directory and the tomcat used is not from the system package as that one already listen on port 80. In the following explanation, we will use file path that you will need to adjust based on your local setting. Here is the list of the variable name with their meaning that will need some adjustments: - TOMCAT_HOME: Directory that contains tomcat when you uncompressed it. - YOUR_SERVER_HOSTNAME: name used for your server when accessed by the web clients.

Setup an HTTP/AJP connector

Edit the file TOMCAT_HOME/conf/server.xml

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
    <Service name="Catalina">
        <Connector port="8081" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" 
              proxyName="YOUR_HOST_NAME" />  

        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" 
              proxyName="YOUR_HOST_NAME" />