﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-花钱的岁月-文章分类-opencms</title><link>http://www.blogjava.net/hjh/category/27312.html</link><description>付出总是有回报的</description><language>zh-cn</language><lastBuildDate>Tue, 13 Nov 2007 09:09:45 GMT</lastBuildDate><pubDate>Tue, 13 Nov 2007 09:09:45 GMT</pubDate><ttl>60</ttl><item><title>opencms中多站点的配置</title><link>http://www.blogjava.net/hjh/articles/160194.html</link><dc:creator>不需要解释</dc:creator><author>不需要解释</author><pubDate>Tue, 13 Nov 2007 05:00:00 GMT</pubDate><guid>http://www.blogjava.net/hjh/articles/160194.html</guid><wfw:comment>http://www.blogjava.net/hjh/comments/160194.html</wfw:comment><comments>http://www.blogjava.net/hjh/articles/160194.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/hjh/comments/commentRss/160194.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/hjh/services/trackbacks/160194.html</trackback:ping><description><![CDATA[<div id="art" style="margin: 15px">opencms官方文档中有一篇关于整合opencms，Apache，tomcat管理多站点的文章--&#8220;Integrating OpenCms, Tomcat and the Apache webserver with mod_proxy&#8221;，这些天按照文档说明自己动手配置了一下，现在把心得体会写出来，以供opencms的研究者，使用者参考，批评指正。<br />
&nbsp;&nbsp; <br />
官方文档的主旨是：运用Apache的Mod_proxy实现opencms的动态静态资源分离，由apache直接存储静态资源，tomcat处理请求中的动态资源，并去除前缀/opencm/opencms，我的配置测试环境是：<br />
<table cellspacing="1" cellpadding="1" width="200" border="1">
    <tbody>
        <tr>
            <td>&nbsp;tool</td>
            <td>&nbsp;version</td>
        </tr>
        <tr>
            <td>&nbsp;gentoo linux<br />
            </td>
            <td>&nbsp;2.6</td>
        </tr>
        <tr>
            <td>&nbsp;apache</td>
            <td>&nbsp;2.0</td>
        </tr>
        <tr>
            <td>&nbsp;tomcat</td>
            <td>&nbsp;5.5</td>
        </tr>
        <tr>
            <td>&nbsp;mysql</td>
            <td>&nbsp;4.1</td>
        </tr>
        <tr>
            <td>&nbsp;opencms</td>
            <td>&nbsp;6.2</td>
        </tr>
    </tbody>
</table>
<br />
在作任何文件的配置修改之前，请最好作个备份！配置步骤如下：<br />
1. 在你的域名服务中设置你的域名，稍后安装及配置过程中将会用到。我的域名是在/etc/hosts 文件中设置的：<br />
<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%; background-color: rgb(255,255,255)">127.0.0.1 localhost localhost.localdomain <br />
            </p>
            <p style="margin: 5px; line-height: 150%; background-color: rgb(255,255,255)">192.168.0.136&nbsp; www.lxbing.com <br />
            </p>
            <p style="margin: 5px; line-height: 150%; background-color: rgb(255,255,255)">192.168.0.136&nbsp; ww.example.com</p>
            <p style="margin: 5px; line-height: 150%; background-color: rgb(255,255,255)">192.168.0.136&nbsp; www.doc.com <br />
            </p>
            <br />
            </td>
        </tr>
    </tbody>
</table>
<br />
2. 清除tomcat下/webapps目录中的全部应用，关闭tomcat，把opencms.war包改为ROOT.war，拷入&nbsp;&nbsp;&nbsp;&nbsp; /webapps目录，因为tomcat默认的应用是ROOT，这样就去除了路径中的第一个opencms。启动tomcat，按步骤安装opencms。可以通过http：//www.lxbing.com:8080/setup 也可以用http://Ip:8080/setup<br />
进行安装。<br />
<strong></strong><br />
3. 安装完毕后你可以通过http://Ip:8080/opencms/system/login进入opencms的工作区，可以看到还有一个/opencms存在于路径中。<br />
找到 <font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">${TOMCAT_HOME}/webapps/ROOT/WEB-INF/config/opencms-importexport.xml文件，编辑</font>节点 <font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">staticexport/rendersettings</font> 中的部分内容，去除上下文环境，因为现在opencms已经作为tomcat的默认应用了，说以它的默认上下文环境就是根目录，编辑后的节点中的相关内容为：<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">&lt;rfs-prefix&gt;/export&lt;/rfs-prefix&gt;</p>
            <p style="margin: 5px; line-height: 150%">&lt;vfs-prefix&gt;${SERVLET_NAME}&lt;/vfs-prefix&gt;</p>
            <p style="margin: 5px; line-height: 150%">&lt;userelativelinks&gt;false&lt;/userelativelinks&gt;</p>
            <p style="margin: 5px; line-height: 150%">&lt;exporturl&gt;http://127.0.0.1:8081${SERVLET_NAME}/handle404&lt;/exporturl&gt;</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
4. 修改<font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">${TOMCAT_HOME}/webapps/ROOT/WEB-INF/config/opencms-system.xml</font> 文件,配置opencms中的多个站点，在节点<font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">system/sites</font> 中设置需要配置的站点(所谓站点就是opencms中的microsite文件类型)，由于测试用的opencms是新安装的，所以我以oepncms中的/default/，/demopages/，/alkacon-documentation/ 为例，具体配置如下：<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">&lt;sites&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp; &lt;workplace-server&gt;http://www.lxbing.com&lt;/workplace-server&gt;&nbsp;&nbsp;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp; &lt;default-uri&gt;/sites/default/&lt;/default-uri&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp; &lt;site server="<span style="font-weight: bold; color: rgb(255,1,2)">http://www.lxbing.com<span style="color: rgb(0,1,2)">"</span></span> uri="/sites/default/"/&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp; &lt;site server="<span style="font-weight: bold; color: rgb(255,1,2)">http://www.example.com</span><span style="font-weight: bold">"</span></p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri="/sites/default/demopages/"/&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp; &lt;site server="<span style="font-weight: bold; color: rgb(255,1,2)">http://www.doc.com</span>" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uri="/sites/default/alkacon-documentation/"/&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&lt;/sites&gt;</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
注意：在这种配置中，所以站点的 uri 都必须在 /site/default/目录下，否则，会报错，我没尝试过能否把/site/default/ 该为根目录/ 或是其他意义的目录，如何有人作过这方面的配置测试，希望能拿出来让大家学习! 每个站点的域名必须是在你的域名服务中定义过的，否则，会报错。<br />
<br />
5. 配置&nbsp;<font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">${TOMCAT_HOME}/conf/</font> 中的<font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">server.xml</font> 文件. <br />
&nbsp;<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">&lt;Server port="8005" shutdown="SHUTDOWN" debug="0"&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;Service name="Tomcat-Standalone"&gt;</p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;!-- Define a connector for the "public visible" server name--&gt;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;Connector port=<span style="color: rgb(255,1,2)">"8081"</span> minProcessors="5" maxProcessors="75"&nbsp;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-weight: bold; color: rgb(255,1,2)">proxyName="www.lxbing.com" proxyPort="80"</span> enableLookups="true" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; redirectPort="8443" acceptCount="100" debug="0" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; connectionTimeout="20000" useURIValidationHack="false" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; disableUploadTimeout="true" /&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;Connector <span style="color: rgb(255,1,2)">port="8082"</span> maxThreads="150" minSpareThreads="25" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; maxSpareThreads="75" enableLookups="false" redirectPort="8443" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; acceptCount="100" <span style="font-weight: bold; color: rgb(255,1,2)">proxyName="www.example.com" proxyPort="80"</span> <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; debug="0" connectionTimeout="20000" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; disableUploadTimeout="true"&nbsp; /&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;Connector port=<span style="color: rgb(255,1,2)">"8088"</span> maxThreads="150" minSpareThreads="25" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &nbsp; maxSpareThreads="75" enableLookups="false" redirectPort="8443" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; acceptCount="100" <span style="font-weight: bold; color: rgb(255,1,2)">proxyName="www.doc.com" proxyPort="80" </span><br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; debug="0" connectionTimeout="20000" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; disableUploadTimeout="true" /&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; &lt;Engine name="Standalone" defaultHost="localhost" debug="0"&gt;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Host name="localhost" debug="0" appBase="webapps"&nbsp;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; unpackWARs="true" autoDeploy="true"&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;!-- You can change "unpackWARs" and "autoDeploy" to false <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; after the installation is finished --&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Logger className="org.apache.catalina.logger.FileLogger" <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; directory="logs" prefix="localhost_log."&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; suffix=".txt" timestamp="true"/&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Host&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Engine&gt;</p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp; &lt;/Service&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&lt;/Server&gt;</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
6. 配置 <span style="font-weight: bold">/etc/Apaches2/</span>中的 <span style="font-weight: bold">httpd.conf</span>文件，使用能支持<span style="font-weight: bold">mod_proxy</span>模块<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">LoadModule alias_module modules/mod_alias.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
7. 配置apache 中的虚拟主机<font style="font-weight: bold; font-family: courier new,courier,monospace" face="Monospace">&lt;VirtualHost&gt;</font> ，apache监听80端口，当<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">NameVirtualHost *:80 <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&lt;VirtualHost *:80&gt; <br />
            &nbsp;&nbsp;&nbsp; &lt;Directory "/var/lib/tomcat-5.5/webapps/ROOT/"&gt;<br />
            &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Order allow,deny Allow from all <br />
            &nbsp;&nbsp;&nbsp; &lt;/Directory&gt; <br />
            &nbsp;&nbsp;&nbsp; <span style="font-weight: bold; color: rgb(255,1,2)">ServerName</span> <span style="color: rgb(255,1,2)">www.example.com</span> <br />
            &nbsp;&nbsp;&nbsp; ServerAdmin webmaster@alkacon.com <br />
            &nbsp;&nbsp;&nbsp; <span style="font-weight: bold; color: rgb(255,1,2)">DocumentRoot</span> "/var/lib/tomcat-5.5/webapps/ROOT/"<br />
            &nbsp;&nbsp;&nbsp; ErrorLog logs/error.log <br />
            &nbsp;&nbsp;&nbsp; # Log only non-redirect requests in "normal" log file <br />
            &nbsp;&nbsp;&nbsp; SetEnvIf Request_URI "\/opencms\/*" redirect <br />
            &nbsp;&nbsp;&nbsp; CustomLog logs/localhost-access.log common env=!redirect &nbsp;&nbsp;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; <span style="color: rgb(0,1,2)">ProxyPass &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opencms/ &nbsp;&nbsp;&nbsp; http://www.example.com/ </span><br />
            &nbsp;&nbsp;&nbsp; RedirectPermanent&nbsp; /opencms/ &nbsp;&nbsp;&nbsp; http://www.example.com/ <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; /resources/&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8082</span>/resources/<br />
            &nbsp;&nbsp;&nbsp; ProxyPass&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; /export/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8082</span>/export/</p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8082</span>/opencms/ <br />
            &nbsp;&nbsp;&nbsp; ProxyPassReverse &nbsp; &nbsp;&nbsp; /&nbsp; &nbsp; &nbsp; &nbsp; http://localhost:<span style="color: rgb(255,1,2)">8082</span>/opencms/ &lt;/VirtualHost&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%"><br />
            </p>
            <p style="margin: 5px; line-height: 150%">&lt;VirtualHost *:80&gt; <br />
            &nbsp;&nbsp;&nbsp; &lt;Directory "/var/lib/tomcat-5.5/webapps/ROOT/"&gt; <br />
            &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Order allow,deny Allow from all <br />
            &nbsp;&nbsp;&nbsp; &lt;/Directory&gt;<br />
            &nbsp;&nbsp;&nbsp; <span style="color: rgb(255,1,2)"><span style="font-weight: bold">ServerName</span> www.lxbing.com</span> <br />
            &nbsp;&nbsp;&nbsp; ServerAdmin webmaster@alkacon.com <br />
            &nbsp;&nbsp;&nbsp; <span style="font-weight: bold; color: rgb(255,1,2)">DocumentRoot</span> "/var/lib/tomcat-5.5/webapps/ROOT/"&nbsp;&nbsp; <br />
            &nbsp;&nbsp;&nbsp; ErrorLog logs/error.log <br />
            &nbsp;&nbsp;&nbsp; # Log only non-redirect requests in "normal" log file <br />
            &nbsp;&nbsp;&nbsp; SetEnvIf Request_URI "\/opencms\/*" redirect <br />
            &nbsp;&nbsp;&nbsp; CustomLog logs/localhost-access.log common env=!redirect &nbsp;&nbsp;&nbsp; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; <span style="color: rgb(255,1,2)">ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opencms/&nbsp;&nbsp;&nbsp;&nbsp; http://www.lxbing.com/ </span><br />
            &nbsp;&nbsp;&nbsp; RedirectPermanent&nbsp; /opencms/ &nbsp; &nbsp; http://www.lxbing.com/ <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /resources/&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8081</span>/resources/&nbsp;&nbsp; &nbsp; &nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /export/&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8081</span>/export/ <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8081</span>/opencms/ <br />
            &nbsp;&nbsp;&nbsp; ProxyPassReverse&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8081</span>/opencms/ &lt;/VirtualHost&gt; <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&lt;VirtualHost *:80&gt; <br />
            &nbsp;&nbsp;&nbsp; &lt;Directory "/var/lib/tomcat-5.5/webapps/ROOT/"&gt;&nbsp;&nbsp; <br />
            &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Order allow,deny Allow from all <br />
            &nbsp;&nbsp;&nbsp; &lt;/Directory&gt;<br />
            &nbsp;&nbsp;&nbsp; <span style="color: rgb(255,1,2)"><span style="font-weight: bold">ServerName</span> www.doc.com </span><br />
            &nbsp;&nbsp;&nbsp; ServerAdmin webmaster@alkacon.com <br />
            &nbsp;&nbsp;&nbsp; <span style="font-weight: bold; color: rgb(255,1,2)">DocumentRoot</span> "/var/lib/tomcat-5.5/webapps/ROOT/" <br />
            &nbsp;&nbsp;&nbsp; ErrorLog logs/error.log <br />
            &nbsp;&nbsp;&nbsp; # Log only non-redirect requests in "normal" log file <br />
            &nbsp;&nbsp;&nbsp; SetEnvIf Request_URI "\/opencms\/*" redirect <br />
            &nbsp;&nbsp;&nbsp; CustomLog logs/localhost-access.log common env=!redirect <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opencms/ ! <br />
            &nbsp;&nbsp;&nbsp; RedirectPermanent&nbsp; /opencms/ http://www.doc.com/ <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /resources/&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8088</span>/resources/ <br />
            &nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /export/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8088</span>/export/ <br />
            </p>
            <p style="margin: 5px; line-height: 150%">&nbsp;&nbsp;&nbsp; ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; / &nbsp; &nbsp; &nbsp; http://localhost:<span style="color: rgb(255,1,2)">8088</span>/opencms/ <br />
            &nbsp;&nbsp;&nbsp; ProxyPassReverse&nbsp;&nbsp;&nbsp; /&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; http://localhost:<span style="color: rgb(255,1,2)">8088</span>/opencms/ &lt;/VirtualHost&gt;</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
在这个配置中，<span style="font-weight: bold">www.lxbing.com</span> 代理的是 http://localhost:<span style="color: rgb(255,1,2)">8081</span>/opencms/,这个页面有一个链接到opencms登录页面的链接，如果按照官方文档中的说明配置为：<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opencms/ ! <br />
            </p>
            <p style="margin: 5px; line-height: 150%">RedirectPermanent /opencms/&nbsp; http://${DOMAIN_NAME}/</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
将无法登录opencms工作区，真确的配置为：<br />
<br />
<table style="border-collapse: collapse" bordercolor="#999999" cellspacing="0" cellpadding="0" width="95%" bgcolor="#f1f1f1" border="1">
    <tbody>
        <tr>
            <td>
            <p style="margin: 5px; line-height: 150%">ProxyPass&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /opencms/ http://${DOMAIN_NAME}/</p>
            <p style="margin: 5px; line-height: 150%">RedirectPermanent&nbsp; /opencms/ http://${DOMAIN_NAME}/</p>
            </td>
        </tr>
    </tbody>
</table>
<br />
在配置虚拟主机时应注意 <span style="color: rgb(255,1,2)"><span style="font-weight: bold">ServerName，</span></span><span style="font-weight: bold; color: rgb(255,1,2)">DocumentRoot，<span style="color: rgb(0,1,2)">以及</span> </span>/resources/， /export/，现在配置完成，可以通过域名访问opencms中的站点了，但是apache和tomcat是怎么分别管理静态，动态资源的，我还不大明白，是不是我的配置中有什么不妥的地方，请大家多多指教！<br />
</div>
<img src ="http://www.blogjava.net/hjh/aggbug/160194.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/hjh/" target="_blank">不需要解释</a> 2007-11-13 13:00 <a href="http://www.blogjava.net/hjh/articles/160194.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>