<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<h1>HowTo: Get rid of the /opencms/opencms-prefix without installing OpenCms as
ROOT-Webapp </h1>
<p><i>Last change: 10 Jan. 2005</i></p>
<p>This HowTo describes how to get rid of the /opencms/opencms-prefix without
installing OpenCms as the ROOT-Webapp. It's not fully tested yet so please provide
Feedback if this configuration causes any problems for you.</p>
<h2>Disclaimer and important notes (please read)</h2>
<p>While reading please bare in mind three facts:</p>
<ol>
<li>The configuration provided in this HowTo is mostly based upon postings on
the <a href="http://www.opencms.org/opencms/en/development/mailinglist.html">opencms-dev mailing-list</a> and i don't deserve the credit for this configuration!
I only used the information floating around on the mailinglist and the apache-websites and
put it together! Without these postings and tutorials this HowTo wouldn't
exists.
</li><li>This configuration is neither tested very well nor optimised for
performance. There are probably many options wich will increase performance or
simplify configuration! This HowTo is not the best way but it should provide you with the general ideas how you could solve this
problem.
</li><li>If you have found errors in this tutorials or have any improvements ready
feel free send them to the opencms-dev mailing list or post them in the forums
(<a href="http://www.opencms-forum.de">http://www.opencms-forum.de</a>). It
will try to add them to this HowTo ASAP.
</li><li>(English is not my native language so sorry for the bad typo ;-)) </li></ol>
<h2>What you will get</h2>
<p>After following this HowTo you will have the following configuration:</p>
<ul>
<li>Dynamic OpenCms content served by http://www.yourdomain.com
</li><li>Static contect served by http://static.yourdomain.com</li></ul><p>This can easily be changed to another setup!</p>
<h2>Tested Environment</h2>
<p>The configuration described below was testet with the following system.</p>
<ul>
<li>Apache Tomcat 5.5.4
</li><li>Sun JDK 1.5.0_01
</li><li>Apache HTTPD 2.0.52 (mod_rewrite, mod_ jk 1.2.8)
</li><li>MySQL 4.0.21
</li><li>Windows Server 2003 WebEdition
</li><li>OpenCms Alpha 3 </li></ul>
<h2>Directorys & Values<br /></h2>
<p>For this HowTo i will assume you used the following directorys & values:</p>
<ul>
<li>${WEBAPP_HOME}: The path to your webapps (e.g. d:/webapps/)
</li><li>${WEBAPP_NAME}: The webapp-name you used for OpenCms (e.g. opencms)
</li><li>${YOURDOMAIN}: The domain-name wich you want to use for OpenCms </li></ul>
<h2>Step 1: Installing and Configuring OpenCms </h2>
<p>Install OpenCms using the normal setup-wizard. After restarting Tomcat log
into the workplace as the administrator and open
'/system/workplace/views/top_fs.jsp'. Search for the line starting with
'this.servpath=' and change the value to "" (<strong>Note</strong>: this should
be the value "rendersettings" from "opencms-importexport.xml" but i haven't
looked up how to access this value yet). The line should now look like this:</p><pre>this.servpath=""; </pre>
<p>Log-off the Workplace and open "WEB-INF\config\opencms-importexport.xml".
Look for the following settings:</p><pre><rfs-prefix>${CONTEXT_NAME}/export</rfs-prefix><br /><vfs-prefix>${CONTEXT_NAME}${SERVLET_NAME}</vfs-prefix></pre>
<p>And change them to:</p><pre><rfs-prefix>http://static.${YOURDOMAIN}</rfs-prefix><br /><vfs-prefix></vfs-prefix> </pre>
<p>Save the file and shutdown your Tomcat.</p>
<h2>Step 2: Configuring Tomcat </h2>
<p>Open the "server.xml" of your Tomcat distribution and look for the
AJP-connector. Change the settings of this connector to have the following values (I
have marked the setting that differs from the standard server.xml):</p><pre> <!-- Define an AJP 1.3 Connector on port 8009 --><br /> <Connector port="8009" <strong>emptySessionPath="true"</strong> enableLookups="false" protocol="AJP/1.3" /> </pre>
<p>Save the file and start Tomcat.<br /></p>
<h2>Step 3: Configuring Apache HTTPD </h2>
<p>I assume you have already configured Apache to load mod_rewrite and mod_jk.
If not, checkout the following pages to get further information (these issues
are more than well documented so you shouldn't have any problems).</p>
<ul>
<li><a href="http://httpd.apache.org/docs-2.0/mod/mod_so.html#loadmodule">http://httpd.apache.org/docs-2.0/mod/mod_so.html#loadmodule</a>
</li><li><a href="http://jakarta.apache.org/tomcat/connectors-doc/install/apache2.html">http://jakarta.apache.org/tomcat/connectors-doc/install/apache2.html</a>
</li></ul>
<h3>Creating a workers.properties-file </h3>
<p>Create a file named "workers.properties" in the conf-directory of your
Apache-directory and insert the following text:</p><pre>worker.list=ocms<br />worker.ocms.type=ajp13<br />worker.ocms.host=localhost<br />worker.ocms.port=8009<br />worker.ocms.lbfactor=1<br /></pre>
<p>Instead of "ocms" you can choose any other value but you have to change this
in the following sections accordingly.</p>
<h3>Loading the workers.properties into Apache </h3>
<p>The Workers are used to connect your Apache to the Tomcat but you still have
to tell Apache to do so. Insert the follwing into your
httpd.conf (after the LoadModule-section).</p><pre>JkWorkersFile conf/workers.properties<br />JkLogFile logs/mod_jk.log<br />JkLogLevel info<br />JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "<br />JkOptions +ForwardKeySize +ForwardURICompat </pre>
<h3>Defining the virtual hosts </h3>
<p>At this point you're almost finished. The last Step is to connect your domain
to the OpenCms-Webapp. I assume you already have created the two virtual hosts
"static.${YOURDOMAIN}" and "${YOURDOMAIN}". Here are the settings for these
virtual hosts:</p>
<p><strong>${YOURDOMAIN}:</strong></p><pre>SetEnvIfNoCase Request_URI ^/${WEBAPP_NAME}/resources/.*$ no-jk<br />RewriteEngine on<br /> <br />RewriteCond %{REQUEST_URI} !^/${WEBAPP_NAME}/resources/.*$ <br />RewriteRule !^/${WEBAPP_NAME}/opencms/?(.*)$ /${WEBAPP_NAME}/opencms%2%{REQUEST_URI} [PT]<br /><br />RewriteCond %{REQUEST_URI} ^/${WEBAPP_NAME}/resources/.*$<br />RewriteRule ^/${WEBAPP_NAME}/(.*)$ /$1 <br /><br />DocumentRoot "${WEBAPP_HOME}/${WEBAPP_NAME}/" <br />JkMount /* ocms</pre>
<p><strong>static.${YOURDOMAIN}:</strong> </p><pre>DocumentRoot "${WEBAPP_HOME}/${WEBAPP_NAME}/export" </pre>
<p>Restart your Apache and you're done.</p>
<h2>List of references</h2>
<ul>
<li><a href="http://gagne.homedns.org/%7Etgagne/articles/ProxyOpenCMS/">http://gagne.homedns.org/~tgagne/articles/ProxyOpenCMS/
</a>
</li><li><a href="http://mail.opencms.org/pipermail/opencms-dev/2004q1/010335.html">http://mail.opencms.org/pipermail/opencms-dev/2004q1/010335.html</a>
</li><li><a href="http://mail.opencms.org/pipermail/opencms-dev/2004q4/014121.html">http://mail.opencms.org/pipermail/opencms-dev/2004q4/014121.html</a>
</li><li><a href="http://jakarta.apache.org/tomcat/connectors-doc/index.html">http://jakarta.apache.org/tomcat/connectors-doc/index.html</a>
</li><li><a href="http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html">http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html</a>
</li></ul>
<h2>Contact</h2>
<p>Please contact me at: "sebastian dot himberger at gmx dot de"
</p>
</body>
</html>