[Zope] RE: Apache 2 and Zope Integration

Samir Mishra SamirMishra at cbuae.gov.ae
Sun Apr 4 00:49:42 EST 2004


You're missing some stuff in your setup.

My Setup, the very basic Zope requires - 
<VirtualHost smishra.cbauh.com:80 >
  ProxyRequests On

  ProxyPass /z
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/apacheVirtua
lHost/VirtualHostRoot/_vh_z/
  ProxyPassReverse /z
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/apacheVirtua
lHost/VirtualHostRoot/_vh_z/
  ProxyPass /misc_
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/misc_
  ProxyPassReverse /misc_
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/misc_
  ProxyPass /p_
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/p_
  ProxyPassReverse /p_
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/p_
  ProxyPass /manage_page_style.css
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/manage_page_style.css
  ProxyPassReverse /manage_page_style.css
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/manage_page_style.css
  ProxyVia On
  
</VirtualHost>


I have Apache & zope installed on the same machine. Apache runs on port 80,
zope on 7080. I'm serving a combination of static, dynamic, PHP generated
content. Currently Zope content is accessed through
http://smishra.cbauh.com/z/, and this URL serves content from
http://<ZopeInstance>:8080/apacheVirtualHost. The last proxy setting is
needed to get the management screens to display with the right style sheets.

So far everything is working fine. This includes management screens.

Note that if you have a root Zope folder named 'z', and that's what you want
to access through Apache, then the above can be reduced to 
  ProxyPass /z
http://localhost:7080/VirtualHostBase/http/smishra.cbauh.com:80/VirtualHostR
oot/z/

Also, you may have to experiment with the '/' at the ends.

Perhaps you can help on some additions I need to make to my setup. Since I
need to do pattern matching, I'm quite certain I need to use rewrite rules
in Apache. I want to block access to all management screens on HTTP (port
80), and allow access to the management functions only through HTTPS. But
I'd like to be "nice" about this. E.g., if a user tries to access
http://smishra.cbauh.com/z/manage<ANYTHING> they would be re-directed to
http://smishra.cbauh.com/z/ without being asked (a security feature). If you
happen to come up with anything, do let me know.

And as you're trying to pitch Zope, perhaps this may add fuel. One of the
things I'm doing in Zope is generating PHP/HTML templates through Zope,
saving the same on the local filesystem so Apache can do its stuff. We want
to extend this to JSP too, I haven't had the time to figure this out yet.
And I end up having to save templates to the local directory and then using
APache PHP AddHandler stuff to render the PHP. I'd like to skip the saving
to directory part and pipe the PHP stuff directly from Zope to Apache. Not
sure if this makes sense...

All the best.

Samir.




-----Original Message-----
From: Ade Fewings [mailto:ade at informatics.bangor.ac.uk]
Sent: Saturday, April 03, 2004 20:08
To: sqmishra at acm.org
Cc: samirmishra at cbuae.gov.ae
Subject: Re: Apache 2 and Zope Integration


CC'd to your other account just in case........

Hi Samir,

Thanks a lot for your help.  I created the Virtual Host Monster in the 
root of Zope and the directory 'Zope' in there as well for our dynamic 
content.  The following is in my httpd.conf on a.b.com:

ProxyPass /Zope http://a.b.com:81/VirtualHostRoot/_vh_Zope
ProxyPassReverse /Zope http://a.b.com:81/VirtualHostRoot/_vh_Zope
ProxyPass /misc_ http://a.b.com:81/misc_
ProxyPass /p_ http://a.b.com:81/p_

Unfortunately, i am finding that when i then browse to 
http://a.b.com/Zope/manage and log in, no further traffic is going thru 
the Apache proxy - instead, it is going straight to a.b.com:81 and not 
thru Apache on a.b.com:80. 

Have i messed something up?

Cheers
Ade



Samir Mishra wrote:

>Resolved this just today. Get rid of the site root stuff. Use one single 
>virtual host monster (VHM) at the root of the Zope site. 
>
>ProxyPass works great, Rewrite rules are good, but they're complicated and
not 
>as simple as proxy rules. I use Proxypass myself.
>
>And this is something I learnt just today. It works with Zope 2.7 & Apache
2. 
>Unfortunately, I don't have access to the httpd.conf script, but look up
how 
>to use __vh__ (I think) in the VHM help docs. These are added to the site 
>when you add a VHM object to your site.
>
>If you don't have a good answer to your question by tomorrow, send me an
email 
>at samirmishra_at_cbuae.gov.ae and I'll help you out.
>
>
>Jim Kutter wrote:
>  
>
>>I got hit with the same snag when I first dove into this as well.
>>
>>Don't use the Proxy stuff directly, use it via mod_rewrite. I forget
>>where I finally found that info.
>>
>>This is from my configs:
>>
>>RewriteEngine on
>>
>># local requests for images redirect to real web server
>>RewriteRule ^/web_resources(.*) http://<removed>/web_resources$1 [L,R]
>>RewriteRule ^/web_images/style.css http://homer:8080/newsite/style.css
>>[L,P]
>>RewriteRule ^/web_images(.*) http://<removed>/web_images$1 [L,R]
>>RewriteRule ^/z_images(.*) http://<removed>/z_images$1 [L,R]
>>    
>># insider (zope content)
>>RewriteRule ^/insider(.*)
>>http://<removed>/VirtualHostBase/http/<removed>:80/sections/VirtualHostR
>>oot/insider$1 [L,P]
>>
>>
>>Good luck!
>>
>>-jim
>>
>>-----Original Message-----
>>From: Ade Fewings [mailto:ade at informatics.bangor.ac.uk] 
>>Sent: Friday, April 02, 2004 3:56 PM
>>To: zope at zope.org
>>Subject: [Zope] Apache 2 and Zope Integration
>>
>>
>>Hi all,
>>
>>I'm trying to persuade our powers-that-be that a switch-over to using 
>>Zope for our website would be "a good idea".  For this, the best way for
>>
>>me to achieve things is using Zope and the existing Apache stuff 
>>together.  I've been following the guide at 
>>http://zope.org/Members/anser/apache_zserver for using Apache's Inverse 
>>Proxy ability to reach our Zope installation.  However, I am having the 
>>problem that i have to log in twice to the management interface and then
>>
>>when i come to log out of it, i get the following error from Apache:
>>
>>The requested URL /manage_zmi_logout was not found on this server.
>>
>>I have the following in httpd.conf [changed the names to protect the 
>>server]:
>>
>>ProxyPass /Zope http://a.b.com:81/
>>ProxyPassReverse /Zope http://a.b.com:81/
>>ProxyPass /misc_ http://a.b.com:81/misc_
>>ProxyPass /p_ http://a.b.com:81/p_
>>
>>I have also added the SiteRoot object in the management root.
>>
>>Does anybody have any idea what i might have done wrong?  Is it because 
>>we are using Apache 2 [2.0.48]?
>>
>>Many thanks
>>Ade
>>
>>    
>>


-- 
___________________________________________________
Ade Fewings MEng 

School of Informatics, University of Wales, Bangor,
Dean Street, Bangor, Gwynedd. LL57 1UT. UK.

ade at informatics.bangor.ac.uk  www.informatics.bangor.ac.uk/~ade
Tel: +44 (0)1248 382736       Fax: +44 (0)1248 361429
___________________________________________________



More information about the Zope mailing list