[opencms-dev] Static export, files not exported to real file system

Brian Jacobs bjacobs at rednoodle.com
Wed Jun 2 15:46:42 CEST 2010


Hi all,

Using OpenCMS 7.5.2, apache 2.2.3, tomcat5

I can't get static resources such as images and style sheets to 
export to the real file system. The approach is apache with mod_proxy 
in combination with tomcat, pages to come from vfs and static 
resources from rfs.

When I browse to the generated html page and look in the source code, 
the paths to these files are what I thought they would be:
/export/sites/site1/_resources/styles/main.css

But the resources aren't being written to the rfs.

I can browse to URLs like these below which result in the this 
stylesheet and image being written out to the rfs.
http://www.site1.com:8083/handle404?exporturi=/export/sites/site1/_resources/styles/main.css
http://www.site1.com:8083/handle404?exporturi=/export/sites/site1/_resources/images/home/header.jpg

In the Workplace, I have the export property set to true for the 
folder these resources are in.

So tomcat and opencms did their jobs and I think the problem is in 
the apache configuration, but I don't see where. I've been trying to 
look at apache log files for entries regarding mod_rewrite or 
mod_proxy however I haven't figured that out.

Any help would be appreciated. Thanks.

- Brian Jacobs

P.S. Below are some config file chunks that might be useful.


-----------------
-----------------
 From the apache config. Mod_proxy and mod_rewrite are loaded.

<VirtualHost *:80>
     ServerName www.site1.com
     ServerAdmin
     DocumentRoot /var/lib/tomcat5/webapps/ROOT
#    DirectoryIndex index.jsp

     ErrorLog logs/www.site1.com/error_log
     CustomLog logs/www.site1.com/access_log common

    # Log only non-redirect requests in "normal" log file
      SetEnvIf Request_URI "\/opencms\/*" redirect

    # 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://www.site1.com/handle404?exporturi=/%{REQUEST_URI}&%{QUERY_STRING} [P]


     ProxyPass         /opencms/                 !
     RedirectPermanent /opencms/                 http://www.site1.com/

     ProxyPass         /resources/               !
     ProxyPass         /export/                  !

     ProxyPass         /                         http://localhost:8083/opencms/
     ProxyPassReverse  /                         http://localhost:8083/opencms/

</VirtualHost>


-----------------
 From opencms-importexport.xml


         <staticexport enabled="true">
                 <staticexporthandler>org.opencms.staticexport.CmsOnDemandStaticExportHandler</staticexporthandler>
                 <linksubstitutionhandler>org.opencms.staticexport.CmsDefaultLinkSubstitutionHandler</linksubstitutionhandler> 

                 <exportpath>export</exportpath>
                 <exportworkpath>temp</exportworkpath>
                 <exportbackups>2</exportbackups>
                 <defaultpropertyvalue>false</defaultpropertyvalue>
                 <defaultsuffixes>
                         <suffix key=".jpg"/>
                         <suffix key=".gif"/>
                         <suffix key=".png"/>
                         <suffix key=".doc"/>
                         <suffix key=".xls"/>
                         <suffix key=".ppt"/>
                         <suffix key=".pdf"/>
                         <suffix key=".txt"/>
                         <suffix key=".css"/>
                         <suffix key=".zip"/>
                         <suffix key=".swf"/>
                 </defaultsuffixes>
                 <rendersettings>
                         <rfs-prefix>/export</rfs-prefix>
                         <vfs-prefix />
                         <userelativelinks>false</userelativelinks> 

                         <exporturl>http://127.0.0.1:8082/handle404</exporturl>
                         <plainoptimization>true</plainoptimization>
                         <testresource uri="/system/shared/page.dtd"/>
                         <resourcestorender>
                                 <regex>/sites/.*</regex>
                                 <regex>/system/workplace/commons/style/.*</regex>
                                 <regex>/system/galleries/.*</regex>
                                 <regex>/system/modules/.*/resources/.*</regex>
                         </resourcestorender>
                 </rendersettings>
         </staticexport>


-----------------

 From the tomcat config

     <Connector port="8082"
                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                enableLookups="false" acceptCount="100" 
connectionTimeout="20000"
                proxyPort="80" disableUploadTimeout="true" 
proxyName="opencms2.site1.com" />

     <Connector port="8083"
                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                enableLookups="false" acceptCount="100" 
connectionTimeout="20000"
                proxyPort="80" disableUploadTimeout="true" 
proxyName="www.site1.com" />





More information about the opencms-dev mailing list