Setting up an OpenCms installation with multi-sites ==================================================== @author Corsin Camichel, corsin.camichel@laax.com @version 1.0 April 5th 2005 @document install_opencms_multisites.txt @software OpenCms 6 Beta 1 Corrin Sun Java 1.4.2_07 Apache httpd 2.0.53 Apache Jakarta Tomcat 5.5.7 including compat MySQL MySQL Server 4.0.22 @licesne license free @origin http://cocaman.ch/projects/opencms/install_opencms_multisites.txt First of all, I want to thank Thomas Weckert and Synyx for the support in their IRC channel. Preparation: Rename the opencms.war to ROOT.war. This is needed to make the OpenCms application the main application. I assume that you have no other web-app running on your server. Copy the ROOT.war to your TomCat directory. In my case this is "D:\web\tomcat\webapps". Start/restart the TomCat service and wait until it is fully loaded. After this, you should find a new directory named "ROOT" in the same direcotry as your ROOT.war. Install OpenCms in the known way. This is actually quiet easy and you should not have any troubles by doing this. Configuration: IMPORTANT! Please make a backup of each file you are editing. It really can happen something bad to this files and you really will need these files for sure. IMPORTANT! You can edit this text-only files with any editor. I prefer Notepad++. You can find this editor under http://notepad-plus.sf.net/. It's free and opensource. 1) opencms.properties You can find this file under the WEB-INF/config directory of your installtion. In my case, this is "D:\web\tomcat\webapps\ROOT\WEB-INF\config". Change the first point "app.name=opencms" to "app.name=ROOT". Save this file and exit. 2) opencms-system.xml You can find this file in the same direcotry as the file above. In my case it's under "D:\web\tomcat\webapps\ROOT\WEB-INF\config". Scroll down until the -tag. Edit here the -tag to fit your needs. I paste my file below. [CODE] srvdv02.DOMAIN.ch /sites/default/ [/CODE] 3) opencms-importexport.xml You can find this file in the same directory as the two files above. In my case they are under "D:\web\tomcat\webapps\ROOT\WEB-INF\config". Search the lines with [CODE]${CONTEXT_NAME}/export ${CONTEXT_NAME}${SERVLET_NAME}[/CODE] Change them to [CODE]/export [/CODE] 4) server.xml This file is used by TomCat to start different services on different ports. You can find this file under the "conf/" directory in the tomcat direcotry. In my case this is "D:\web\tomcat\conf". I paste here my config file and explain some things you may need to know. [CODE] [/CODE] For each site you need/want, you have to add a new container of "". It should work if you copy one of mine. Just make sure the port you use is free and unused. 5) httpd.conf The next step is the configuration of the Apache httpd-server. This file is located under the "conf/" directory from apache2. In my case this is "D:\web\httpd\Apache2\conf". Search the lines with "LoadModule" and add this to lines: [CODE]LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so[/CODE] Now scroll to the bottom of this file. Here starts the section with -tags. Each of our site is such a container. I am pasting one of my VirtualHost and try to explain some things. The linse you have to change are marked with an arrow (#<---). [CODE] ServerName octest01.DOMAIN.ch #<--- change to your domain-name ServerAdmin corsin.camichel@laax.com #<--- change to your mail DocumentRoot "D:/web/tomcat/webapps/ROOT/" #<--- change to your webapps directory ErrorLog logs/octest01_DOMAIN_ch-error.log #<--- change to a name that fits your environment # Log only non-redirect requests in "normal" log file SetEnvIf Request_URI "\/opencms\/*" redirect CustomLog logs/octest01_DOMAIN_ch-redirect.log common env=redirect #<--- change to a name that fits your environment CustomLog logs/octest01_DOMAIN_ch-access.log common env=!redirect #<--- change to a name that fits your environment # Redirect all request to non-existing file in the export directory to OpenCms which will generate the files "on the fly" RewriteEngine on RewriteCond %{REQUEST_URI} ^/export/(.*) [NC] RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}" !-f RewriteCond "%{DOCUMENT_ROOT}%{REQUEST_FILENAME}/index_export.html" !-f RewriteRule .* http://127.0.0.1:8082/opencms/handle404?exporturi=%{REQUEST_URI}&%{QUERY_STRING} [P] # Also redirect all other 404 errors to OpenCms ErrorDocument 404 /system/shared/handle404.html # Basic proxy rules # Change the port (8082) to the port you specified in the server.xml under step 4 ProxyPass /export/ http://localhost:8082/export/ ProxyPassReverse /export/ http://localhost:8082/export/ ProxyPass /resources/ http://localhost:8082/resources/ ProxyPassReverse /resources/ http://localhost:8082/resources/ ProxyPass /opencms/ http://localhost:8082/opencms/ ProxyPassReverse /opencms/ http://localhost:8082/opencms/ ProxyPass / http://localhost:8082/opencms/ ProxyPassReverse / http://localhost:8082/opencms/ [/CODE] I hope this manual/howto will help you by setting up an opencms-installation with multi-sites. I will continue to update this manual/howto if I find any error, mistake, better solution or typos. Best regards Corsin Camichel Mountain Vision AG CH-7032 Laax corsin.camichel@laax.com www.laax.com - click and go for it! Ein Unternehmen der Weissen Arena Gruppe