» Jease » Documentation

Want to contribute?

1970-01-01

Do you want to contribute to Jease? Writing documentation is a good place to get started and will help to get people becoming more familiar with Jease. Any contribution is appreciated.

Hosting

Creating Domain Roots

If you want to host multiple domains within a single Jease instance, you have to create a Folder on the root level with an id which equals the domain name and put your content into this folder.

So if you want to host a site with the domain "www.anothersite.com", you'll have to create a Folder with id="anothersite.com" ("www." gets automatically translated by Jease) and store all content of your site within this Folder.

Using Transparent URLs

The only problem with this solution is that you will get an additional path prefix in all of your URLs (like http://www.anothersite.com/anothersite.com/contact). Depending on your requirements and your environment this maybe no problem for you at all, so you're fine.

But if you're obsessed with nice and transparent URLs like me, you'll have to configure Apache as front end server to clean up the URLs. All you have to do is to enable mod_proxy_html for your Apache. Most Linux distributions provide mod_proxy_html in their repositories.

The configuration for a virtual host with mod_proxy_html enabled is straightforward:

ProxyRequests Off

<Proxy http://localhost:8080/>
Order Allow,Deny
Allow from all
</Proxy>

<VirtualHost *:80>
ServerName anothersite.com
ServerAlias www.anothersite.com
SetOutputFilter proxy-html
ProxyHTMLDoctype XHTML Legacy
ProxyPass /site http://localhost:8080/site
ProxyPass /zkau http://localhost:8080/zkau
ProxyPass /anothersite.com http://localhost:8080/anothersite.com
ProxyPass / http://localhost:8080/anothersite.com/
ProxyPassReverse / http://localhost:8080/anothersite.com/
ProxyHTMLURLMap ^(\./~)?/anothersite.com/? / [R]
</VirtualHost>

Configuring Multiple Templates

Most likely you want to use different layouts for your different sites, so you need some kind of switch which forwards requests for different domains to different templates. All you have to do is to create a little Proxy-dispatcher which needs to be configured via JEASE_SITE_DESIGN. So instead of pointing JEASE_SITE_DESIGN directly to your Page.jsp for your layout, you'll just configure the path to the following Proxy.jsp (e.g. /site/Proxy.jsp).

<%@page import="jfix.servlet.*,jease.cmf.service.*,jease.cms.domain.*"%>
<%
  String path = ((Content) request.getAttribute("Node")).getPath();
  if (path.startsWith("/example") || Servlets.getHost(request).endsWith("example.com")) {
    request.setAttribute("Root", Nodes.getByPath("/example"));
    request.getRequestDispatcher("example/Page.jsp").include(request, response);
  } else {
    request.getRequestDispatcher("standard/Page.jsp").include(request,response);
  }
%>

Running Jease behind Apache with mod_jk

To run Jease behind Apache2, you can follow these steps for Debian / Ubuntu:

1. Run command

sudo apt-get install libapache2-mod-jk

2. Next run

a2enmod jk

3. Update settings in /etc/libapache2-mod-jk/workers.properties by changing properties workers.tomcat_home and workers.java_home to reflect your environment. Example is given below:

#
# workers.tomcat_home should point to the location where you
# installed tomcat. This is where you have your conf, webapps and lib
# directories.
#
workers.tomcat_home=/opt/apache-tomcat-7.0.20

#
# workers.java_home should point to your Java installation. Normally
# you should have a bin and lib directories beneath it.
#
workers.java_home=/usr/lib/jvm/java-6-sun

4. Add an entry in apache site file e.g /etc/apache2/sites-enabled/000-default. For example, if your Jease root folder is jease, add an entry at the end as follows:


<VirtualHost *:80>
  .... 
  JKMount /jease* ajp13
</VirtualHost>

5. Restart apache
6. Access jease as http://yourdomainurl/jease

Last modified on 2011-08-20 by Maik Jablonski