MultiSite configuration instructions

From OpenCms Wiki
Revision as of 22:47, 9 November 2006 by Ebessette (Talk | contribs)
Jump to: navigation, search

If you are running OpenCMS (6.0 or greater) in Tomcat using an Apache front end, there are four basic steps to configuring a new site in your implementation:

Contents

Create the containing folder for the site in the OpenCMS Explorer

In the OpenCMS Explorer view, change to the '/' site, go into the 'sites' folder, and create a new folder. The folder name is case-sensitive, so keep track of exactly what you entered. For the examples that follow, we'll assume the creation of a /sites/MyNewSite folder.

Add site information to OpenCMS's configuration

In order to make your new site available within OpenCMS, we need to modify the opencms-system.xml configuration file, located in <opencmsroot>/WEB-INF/config/.

Find the section of opencms-system.xml that looks like:

 <sites>
    <workplace-server>http://www.mysite.com:8080</workplace-server>
    <default-uri>/sites/default/</default-uri>
    <site server="www.mysite.com" uri="/sites/default/"/>
 </sites>

and add another site definition as follows:

    <site server="www.mynewsite.com" uri="/sites/MyNewSite/"/>

This tells OpenCMS that when it receives a request for www.mynewsite.com, it should serve that request out of the MyNewSite container.

Add site information to Tomcat's configuration

In order for Tomcat to correctly route web requests to the correct site in OpenCMS, we need to modify the server.xml configuration file, located in <tomcatroot>/conf.

Find the section of server.xml that looks like:

   <Connector port="8080" maxHttpHeaderSize="8192"
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
              enableLookups="false" redirectPort="8443" acceptCount="100"
              connectionTimeout="20000" disableUploadTimeout="true" />

and add another connector definition as follows:

   <Connector port="8081" maxHttpHeaderSize="8192"
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
              enableLookups="false" redirectPort="8443" acceptCount="100"   
              proxyName="www.mynewsite.com" proxyPort="80"
              connectionTimeout="20000" disableUploadTimeout="true" />

The port attribute (8081 in the example above) should be unique within your server.xml. The proxyName attribute should match the server attribute in your site definition in opencms-system.xml above.

Once you've made this change and restarted Tomcat, you should be able to go to http://YourTomcatServer:8081/opencms/opencms/ and see your MyNewSite content.

Add site information to Apache's configuration

Finally, we need to add a virtual host to Apache to handle requests for your new site. This will be done in httpd.conf (location varies depending on the layout under which you installed Apache -- on my system, it's in /usr/local/etc/apache). In Apache 1.3.x, the virtual host configuration will look something like:

  <VirtualHost Server.IPAddress.Goes.Here>
     DocumentRoot /usr/local/www/htdocs
     ServerName www.mynewsite.com
     ProxyPass / http://localhost:8081/opencms/opencms/
     ProxyPassReverse / http://localhost:8081/opencms/opencms/
  </virtualHost>

The ServerName is the hostname that'll be matched against any incoming requests -- it doesn't have to match your Tomcat proxyName and OpenCMS site server, but it'll be less confusing to troubleshoot later if it does. The URL used in the ProxyPass and ProxyPassReverse lines should point to the Tomcat connector you configured in the previous step.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox