[Setup] Apache sites with Zope sites

Christopher Boomer cawb at loughshore.com
Tue Mar 17 14:01:05 UTC 2009


Ricardo Newbery wrote:
>
> On Mar 16, 2009, at 3:48 PM, cawb wrote:
>
>> Let's say:
>>    abc.tld and xyz.tld via zope
>>    example.tld and simple.tld via apache
>>
>> I've got apache installed and working.  I've got zope installed and 
>> working.
>>
>> I create a file called zope.conf in /etc/httpd/conf.d and place the
>> following in it.
>>
>> RewriteCond %{HTTP_HOST} ^www.abc.tld$
>> ServerName www.abc.tld
>> RewriteRule ^/(.*) \
>>
>> http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/abcplonesite/VirtualHostRoot/$1 
>>
>> [L,P]
>>
>> This correctly maps incoming requests to my plone site.
>>
>> Now, I want to mix this with
>>
>> <VirtualHost example.tld:80>
>> ServerName www.example.tld
>> DocumentRoot /home/user/example
>> </VirtualHost>
>>
>> but as soon as I do, all sites are served from apache, not zope.
>>
>> I have tried wrapping the zope rewrites into individual virtual host 
>> tags
>> and received warnings.
>
>
> This is the most common approach.  Put all your sites, Zope and 
> static, inside individual VirtualHost containers.  You don't describe 
> what warnings you get.  Do you have a NameVirtualHost directive before 
> the VirtualHost container?
>
> NameVirtualHost <ip address>:80
>
> Ric
>
>
A typical error, which makes no sense to me, but which clearly indicates 
I have not understood the apache directives correctly is:

[Tue Mar 17 13:01:54 2009] [warn] VirtualHost www.abc.tld:80 overlaps 
with VirtualHost www.xyz.tld:80, the first has precedence, perhaps you 
need a NameVirtualHost directive

The server has only one IP address and I have in the file simply:
"""
RewriteEngine On
NameVirtualHost *:80

<VirtualHost www.example.tld:80>
  ServerName www.example.tld
  DocumentRoot /home/user/example
</VirtualHost>

<VirtualHost www.abc.tld:80>
  ServerName www.abc.tld
  RewriteCond %{HTTP_HOST} ^www.abc.tld$
  RewriteRule ^/(.*) \
    
http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/abcplonesite/VirtualHostRoot/$1 
[L,P]
</VirtualHost>

<VirtualHost www.xyz.tld:80>
  ServerName www.xyz.tld
  RewriteCond %{HTTP_HOST} ^www.xyz.tld$
  RewriteRule ^/(.*) \
    
http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/xyzplonesite/VirtualHostRoot/$1 
[L,P]
</VirtualHost>
"""

But everything that is served comes from www.example.tld


The rewrite conditions work fine if I revert to
"""
#<VirtualHost example.tld:80>
# ServerName www.example.tld
# DocumentRoot /home/user/example
#</VirtualHost>

#<VirtualHost www.abc.tld:80>
# ServerName www.abc.tld
  RewriteCond %{HTTP_HOST} ^www.abc.tld$
  RewriteRule ^/(.*) \
    
http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/abcplonesite/VirtualHostRoot/$1 
[L,P]
#</VirtualHost>

#<VirtualHost www.xyz.tld:80>
#  ServerName www.xyz.tld
  RewriteCond %{HTTP_HOST} ^www.xyz.tld$
  RewriteRule ^/(.*) \
    
http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/xyzplonesite/VirtualHostRoot/$1 
[L,P]
#</VirtualHost>
"""


I've tried ServerAlias in place of server name 
(http://plone.org/documentation/tutorial/plone-apache/virtualhost).
I've tried <VirtualHost *:80> in one and more blocks.
I've tried the virtualhost sections without the RewriteCond statements.
The clue is definitely that nothing appears in my rewrite logs when the 
VirtualHost sections are in place.

I'm just no apache expert.



More information about the Setup mailing list