[opencms-dev] "Multiple Site without, /opencms/opencms/" using Apache for static content

Bernd Wolfsegger bw at code-create.com
Wed Apr 13 18:50:41 CEST 2005


Hi Peter,

one remark on static content feature:

If requests to /export are not handled by opencms, no files form the VFS will 
ever be copied to the RFS so that they can be used as static content in 
further requests (originally there is no static content). So the "static" 
content functionality will only work if at least /export requests run  
through opencms.
Eg if you have images in opencms in the resources folder in your module, they 
will be copied to the filesystem when they are requested for the first time.
But if the /export request does not run through tomcat/opencms they are never 
copied to the filesystem and they will be served from the database always.

Other content that should not be handled by tomcat:
Isn't it possible to achieve the same with:

PropyPass /dir_html !

This has to be put in front of all the other ProxyPass directives.

And for the aditional webapp, you need only the lines:

ProxyPass         /dir_webapp/               http://localhost:8089/dir_webapp/
ProxyPassReverse  /dir_webapp/               http://localhost:8089/dir_webapp/

and than the rest of the ProxyPass directives.

I see no reason why to use the Rewrite engine, but though I have not tested 
the rewrite solution I can see no drawbacks either. :)

Well and I will test this other new mod_jk solution from
Sebastian Himberger when it is posted.
It's always good to have different working solutions for the same problem.

Kind regards, Bernd

On Wednesday 13 April 2005 14:50, Peter Birchmeier wrote:
> Hi
> I just wanted to give a litte input for the multisite configuration. My
> idea was to remove /opencms/opencms/ by the effective approach of Bernd
> Wolfsegger while using Apache for static content (/export and
> /resources). Thus you're even able to use php in seperate directories as
> well as other webapps.
>
> only modifications of the virtual host definition are needed:
>
> <VirtualHost 192.168.0.5:80>
>     ServerName www.mysite.com
>     ServerAdmin me at mysite.com
>     DocumentRoot "/srv/www/tomcat/developer/webapps/"
>     CustomLog /var/log/apache2/www_error_log error
>     CustomLog /var/log/apache2/www_access_log common
>     CustomLog /var/log/apache2/www_referer_log referer
>     CustomLog /var/log/apache2/www_agent_log agent
>
> 	<Directory "/srv/www/tomcat/developer/webapps/">
>     		AllowOverride All
> 		Order allow,deny
>     		Allow from all
> 	</Directory>
>
> 	RewriteEngine on
>
>
> 	RewriteRule ^/resources/(.*)$ /ROOT/resources/$1 [PT]
> 	RewriteRule ^/export/(.*)$ /ROOT/export/$1 [PT]
>
> #A)	RewriteCond %{REQUEST_URI} !^/dir_html/.*$
> #B)	RewriteCond %{REQUEST_URI} !^/dir_webapp/.*$
> 	RewriteCond %{REQUEST_URI} !^/ROOT/.*$
> 	RewriteCond %{REQUEST_URI} !^/opencms/.*$
> 	RewriteRule ^/(.*)$ /opencms/$1 [PT]
>
> #B)	ProxyPass         /dir_webapp/              
> http://localhost:8089/dir_webapp/ #B)	ProxyPassReverse  /dir_webapp/       
>        http://localhost:8089/dir_webapp/ ProxyPass         /opencms/       
>        http://localhost:8089/opencms/ ProxyPassReverse  /opencms/          
>     http://localhost:8089/opencms/
>
> </VirtualHost>
>
> Remarks:
> 1. The mod_rewrite library has to be included before the mod_proxy
> libraries. 2. A) is a way to include an additional html/php directory
> (webapps/dir_html/) 3. B) includes an other webapp directory
> (webappas/dir_webapp/)
> 4. I installed OpenCMS over Tomcat (localhost:8080), i haven't tested yet
> if it works over Apache.
>
> I'm not sure if it would be better to include the additional html
> directories in the ROOT directory, so they are not treated as webapps by
> the tomcat engine.
>
> By the way:
> There is an other possibility to remove the /opencms/opencms/ by rewriting
> the urls and sending requests to mod_jk. But no matter if a used ProxyPass
> or Rewrite, i couldn't manage to remove the /opencms/opencms/ while not
> renaming the webapp directory to ROOT.
>
> Peter Birchmeier



More information about the opencms-dev mailing list