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

Peter Birchmeier pbirchmeier at gmx.ch
Wed Apr 13 13:50:55 CEST 2005


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