You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Fred Vos <fr...@planet.nl> on 2002/12/30 15:57:46 UTC

Url to virtual host - rewrite rule

Hello,

I've installed Apache 1.3.26, Tomcat 4.0.4 and cocoon 2.0.4 under Linux. 
Everything is working fine. If I go to http://localhost:8080 I see the 
Tomcat welcome page. I also have configured mod_jk successfully as you 
can see below.

Now I want to get cocoon working for a webserver with two sites running: 
www.cdls-nl.org and www.mokolo.com. Some time ago I created two virtual 
hosts, both serving static html-pages and all worked fine. I want the 
mokolo.com site to be the first one to work under cocoon. I've searched 
the archive of this list for hints and this helped

This is what I've done so far. I created a subdirectory named 'mokolo' 
in the /opt/jakarta/tomcat/webapps/cocoon directory. In the sitemap.xmap 
in the cocoon directory, I created a reference to a subsitemap like this:

   <map:match pattern="mokolo/*">
    <map:mount uri-prefix="mokolo/" check-reload="yes" 
src="mokolo/sitemap.xmap" reload-method="synchron"/>
   </map:match>

In the mokolo subdirectory I created the subsitemap and files, so it 
could display the text 'Site under construction...' if the file 
index.html is requested. This is the only page it can serve.

Now I want to configure the virtual server for www.mokolo.com. Here's 
the entry in httpd.conf that I have now:

<VirtualHost *>
ServerName www.mokolo.com
DocumentRoot /opt/jakarta/tomcat/webapps/cocoon
JkMount /* ajp13
ErrorLog /var/log/httpd/mokolo.com/error_log
CustomLog /var/log/httpd/mokolo.com/access_log common
RewriteEngine On
RewriteRule mokolo/(.*) /cocoon/mokolo/$1 [PT]
</VirtualHost>

If I restart the servers and point my browser to 
http://www.mokolo.com/index.html, I get the Tomcat welcome page. If I go 
to http://www.mokolo.com/cocoon I get the cocoon welcome page. If I go 
to http://www.mokolo.com/cocoon/mokolo/index.html I get my 'Site under 
construction....' page. Thanks to the rewrite rule I can see my 'Site 
under construction ...' page too if I go to 
http://www.mokolo.com/mokolo/index.html.

I've played with almost every possible entry and the rewrite rules but 
with no success. How can I get my 'Site under construction...' page when 
pointing the browser to http://www.mokolo.com/index.html?

Thanks for your help,

Fred



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Url to virtual host - rewrite rule

Posted by Andrew Savory <an...@luminas.co.uk>.
Hi Fred,

On Mon, 30 Dec 2002, Fred Vos wrote:

> Just found out myself that the following VirtualHost entry works:
>
> <VirtualHost *>
> ServerName www.mokolo.com
> DocumentRoot /opt/jakarta/tomcat/webapps
> JkMount /* ajp13
> ErrorLog /var/log/httpd/mokolo.com/error_log
> CustomLog /var/log/httpd/mokolo.com/access_log common
> RewriteEngine On
> RewriteRule (.*) /cocoon/mokolo$1 [PT]
> </VirtualHost>
>
> I removed '/cocoon' from the basedir and changed the RewriteRule.

If you put your example site in the mount/ directory of cocoon, there is
no need to edit the cocoon sitemap. The following will then work, too:

<VirtualHost ip.of.mokolo.com>
        ServerName www.mokolo.com
        RewriteEngine on
        RewriteLog /var/log/apache/rewrite.log
        RewriteLogLevel 9

        RewriteCond ${REQUEST_URI} !/mount/mokolo/.*
        RewriteRule ^(.*)/$ /mount/mokolo$1/index.html [PT]
        RewriteCond ${REQUEST_URI} !/mount/mokolo/.*
        RewriteRule ^/(.*[^/]) /mount/mokolo/$1 [PT]

        JkMount /* ajp13
</VirtualHost>

Hope that helps,

Andrew.

-- 
Andrew Savory                                Email: andrew@luminas.co.uk
Managing Director                              Tel:  +44 (0)870 741 6658
Luminas Internet Applications                  Fax:  +44 (0)700 598 1135
This is not an official statement or order.    Web:    www.luminas.co.uk


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Url to virtual host - rewrite rule

Posted by Fred Vos <fr...@planet.nl>.
Just found out myself that the following VirtualHost entry works:

<VirtualHost *>
ServerName www.mokolo.com
DocumentRoot /opt/jakarta/tomcat/webapps
JkMount /* ajp13
ErrorLog /var/log/httpd/mokolo.com/error_log
CustomLog /var/log/httpd/mokolo.com/access_log common
RewriteEngine On
RewriteRule (.*) /cocoon/mokolo$1 [PT]
</VirtualHost>

I removed '/cocoon' from the basedir and changed the RewriteRule.

Fred

Fred Vos wrote:

> Hello,
>
> I've installed Apache 1.3.26, Tomcat 4.0.4 and cocoon 2.0.4 under 
> Linux. Everything is working fine. If I go to http://localhost:8080 I 
> see the Tomcat welcome page. I also have configured mod_jk 
> successfully as you can see below.
>
> Now I want to get cocoon working for a webserver with two sites 
> running: www.cdls-nl.org and www.mokolo.com. Some time ago I created 
> two virtual hosts, both serving static html-pages and all worked fine. 
> I want the mokolo.com site to be the first one to work under cocoon. 
> I've searched the archive of this list for hints and this helped
>
> This is what I've done so far. I created a subdirectory named 'mokolo' 
> in the /opt/jakarta/tomcat/webapps/cocoon directory. In the 
> sitemap.xmap in the cocoon directory, I created a reference to a 
> subsitemap like this:
>
>   <map:match pattern="mokolo/*">
>    <map:mount uri-prefix="mokolo/" check-reload="yes" 
> src="mokolo/sitemap.xmap" reload-method="synchron"/>
>   </map:match>
>
> In the mokolo subdirectory I created the subsitemap and files, so it 
> could display the text 'Site under construction...' if the file 
> index.html is requested. This is the only page it can serve.
>
> Now I want to configure the virtual server for www.mokolo.com. Here's 
> the entry in httpd.conf that I have now:
>
> <VirtualHost *>
> ServerName www.mokolo.com
> DocumentRoot /opt/jakarta/tomcat/webapps/cocoon
> JkMount /* ajp13
> ErrorLog /var/log/httpd/mokolo.com/error_log
> CustomLog /var/log/httpd/mokolo.com/access_log common
> RewriteEngine On
> RewriteRule mokolo/(.*) /cocoon/mokolo/$1 [PT]
> </VirtualHost>
>
> If I restart the servers and point my browser to 
> http://www.mokolo.com/index.html, I get the Tomcat welcome page. If I 
> go to http://www.mokolo.com/cocoon I get the cocoon welcome page. If I 
> go to http://www.mokolo.com/cocoon/mokolo/index.html I get my 'Site 
> under construction....' page. Thanks to the rewrite rule I can see my 
> 'Site under construction ...' page too if I go to 
> http://www.mokolo.com/mokolo/index.html.
>
> I've played with almost every possible entry and the rewrite rules but 
> with no success. How can I get my 'Site under construction...' page 
> when pointing the browser to http://www.mokolo.com/index.html?
>
> Thanks for your help,
>
> Fred
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>




---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>