5. Multiple Portal Instances

Liferay was built from the ground up to be used by application service providers. The following is a sample list of portals running off of one portal instance hitting one database and shows the capabilities of Liferay: http://demo.liferay.net, http://my.ccuc.net, http://my.3sixteen.com, http://www.gatewayfriends.org, http://www.jasonandiris.com. Users in each of these portals have no information about the other portals. They are separated by domain and each portal exists in its own space based on the company's id.

5.1. JBoss+Jetty

Coming soon...

5.2. JBoss+Tomcat

  1. Edit C:\Windows\system32\drivers\etc\hosts so that www.alpha.com and www.beta.com resolve to your local machine. This will help in testing the setup.

    127.0.0.1 www.alpha.com
    127.0.0.1 www.beta.com
  2. Install JBoss+Tomcat.

  3. Rename /server/default/deploy/ext.ear/portal-web-complete.war to portal-web-alpha.war.

    Copy /server/default/deploy/ext.ear/portal-web-alpha.war to portal-web-beta.war.

  4. Edit /server/default/deploy/ext.ear/portal-web-alpha.war/WEB-INF/web.xml and change the value of the company id to alpha.com.

    <context-param>
        <param-name>company_id</param-name>
        <param-value>alpha.com</param-value>
    </context-param>

    On startup, the portal will create the necessary database entries and create a default user account with test@alpha.com as the login and test as the password.

    Repeat this step for /server/default/deploy/ext.ear/portal-web-beta.war/WEB-INF/web.xml but replace alpha.com with beta.com.

  5. Edit /server/default/deploy/ext.ear/portal-web-alpha.war/WEB-INF/jboss-web.xml to add the context root and virtual host.

    <jboss-web>
        <security-domain>java:/jaas/PortalRealm</security-domain>
        <context-root>/</context-root>
        <virtual-host>www.alpha.com</virtual-host>
        ...
    </jboss-web>
    
    Repeat this step for /server/default/deploy/ext.ear/portal-web-beta.war/WEB-INF/jboss-web.xml but replace alpha.com with beta.com.
  6. Edit /server/default/deploy/ext.ear/META-INF/application.xml.

    Remove the old reference to portal-web-complete.war and add the references to portal-web-alpha.war and portal-web-beta.war.

    <module>
        <web>
            <web-uri>portal-web-alpha.war</web-uri>
            <context-root>/</context-root>
        </web>
    </module>
    <module>
        <web>
            <web-uri>portal-web-beta.war</web-uri>
            <context-root>/</context-root>
        </web>
    </module>
  7. Edit /server/default/deploy/jbossweb-tomcat50.sar/server.xml to add the alpha and beta hosts.

    <Engine name="jboss.web" defaultHost="www.alpha.com">
        ...
        <Host name="www.alpha.com" ...
            ...
            <DefaultContext cookies="true" crossContext="true" override="true" />
        </Host>
        <Host name="www.beta.com" ...
            ...
            <DefaultContext cookies="true" crossContext="true" override="true" />
        </Host>
    </Engine>
  8. Start JBoss+Tomcat and access the portals with your browser at http://www.alpha.com and http://www.beta.com. Your user login and password combinations are test@alpha.com/test and test@beta.com/test.

5.3. Jetty

Coming soon...

5.4. Orion

  1. The steps for Orion are more complicated because Orion allows you to share two servlet WARs. Instead of copying the entire portal-web-complete.war (several megs) for each portal instance, you can have a mini WAR that contains the basic XML information and have it reference the larger portal-web.war.

  2. Edit C:\Windows\system32\drivers\etc\hosts so that www.alpha.com and www.beta.com resolve to your local machine. This will help in testing the setup.

    127.0.0.1 www.alpha.com
    127.0.0.1 www.beta.com
  3. Install Orion with the instructions for your Development Environment. The instructions for Orion will not make sense unless you are developing from the source.

  4. Edit /portal/web-sites/web-sites.xml and add entries for alpha.com and beta.com.

    <web-site id="alpha.com">
        <forward-url>/c</forward-url>
    </web-site>
    <web-site id="beta.com">
        <forward-url>/c</forward-url>
    </web-site>
  5. Run ant clean start deploy from /portal.

  6. Edit /orion/config/application.xml and add entries for alpha.com and beta.com.

    <web-module id="alpha.com-web" path="../applications/alpha.com-web.war" />
    <web-module id="beta.com-web" path="../applications/beta.com-web.war" />
  7. Edit /orion/config/server.xml and add entries for alpha.com and beta.com.

    <web-site path="./web-sites/alpha.com-web.xml" />
    <web-site path="./web-sites/beta.com-web.xml" />
  8. Create /orion/config/web-sites/alpha.com-web.xml.

    <web-site virtual-hosts="www.alpha.com">
        <default-web-app application="default" name="alpha.com-web" load-on-startup="true" />
        <web-app application="default" name="portal-web" root="/portal" load-on-startup="true" />
        <access-log path="../../log/alpha.com-web-access.log" />
    </web-site>

    On startup, the portal will create the necessary database entries and create a default user account with test@alpha.com as the login and test as the password.

    Repeat this step for /orion/config/web-sites/beta.com-web.xml but replace alpha.com with beta.com.

  9. Start Orion and access the portals with your browser at http://www.alpha.com and http://www.beta.com. Your user login and password combinations are test@alpha.com/test and test@beta.com/test.

5.5. Tomcat

Coming soon...