[Zope] Apache 2 and Zope Integration
JohanNyberg at tsl.uu.se
JohanNyberg at tsl.uu.se
Wed Apr 7 11:13:03 EDT 2004
Hi Jim!
Thanks a lot for a very fast reply which solved the problem! There was
a small misprint in your mail: it should say p_ instead of _p. I also
had to add a RewriteRule for misc_ (there were errors in the apache error
saying: File does not exist: /var/www/html/misc_).
However, it seems to me your proposal is a somewhat brute force way of
solving the problem. Zope "should" add /zope/ to all URL:s it delivers,
but it does not. In any case, my problem is solved for the moment.
This is my current VirtualHost definition that works for me:
NameVirtualHost *
<VirtualHost *>
ServerName myhost.mydomain
<IfModule mod_rewrite.c>
RewriteEngine On
# use RewriteLog to debug problems with your rewrite rules
# disable it after you found the error our your harddisk will be filled *very fast*
#RewriteLog "/var/log/apache2/rewrite_log"
#RewriteLogLevel 2
RewriteRule ^/zope(.*) \
http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHostRoot/_vh_zope/$1 [L,P]
RewriteRule ^/manage(.*) \
http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHostRoot/manage$1 [L,P]
RewriteRule ^/p_(.*) \
http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHostRoot/p_$1 [L,P]
RewriteRule ^/misc_(.*) \
http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHostRoot/misc_$1 [L,P]
RewriteRule ^/(.*) - [L]
</IfModule>
<IfModule mod_proxy.c>
ProxyVia On
# prevent the webserver from beeing used as proxy
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>
</IfModule>
</VirtualHost>
Thanks again for your help.
Johan
On Wed, 07 Apr 2004, Jim Kutter wrote:
> Try adding a re-write rule for /manage as well.
>
> RewriteRule ^/manage(.*) \
>
> http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHost
> Root/manage$1 [L,P]
>
> But you will also need the following to get the images (object icons,
> etc...)
> RewriteRule ^/_p(.*) \
>
> http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHost
> Root/_p$1 [L,P]
>
> Put these before your catch-all rule.
>
> In all truth, I never put the _vh_ stuff in the re-write paths, partly
> because I myself never quite understood their use. The above lines
> should work for you.
>
> -jim
>
> -----Original Message-----
> From: JohanNyberg
> Sent: Wednesday, April 07, 2004 10:16 AM
> Cc: zope at zope.org
> Subject: [Zope] Apache 2 and Zope Integration
>
>
> Hi,
>
> I have also tried to solve this problem without success. I simply want
> Zope to serve the contents of http://myhost.mydomain/zope, while
> Apache2 serves all other files via http://myhost.mydomain/.
>
> I can reach the Zope Quick Start page, which in my case is at
> http://myhost.mydomain/zope, but when I click on the Zope Management
> Interface link on this page I get the error
>
> The requested URL /manage was not found on this server.
>
> I also get an error in the apache error log:
>
> [Wed Apr 07 15:33:17 2004] [error] [client <removed>] File does not
> exist: /var/www/html/manage_page_style.css, referer:
> http://myhost.mydomain/zope/
>
> which is probably why the style of the zope pages does not look so
> nice. If I manually go to http://myhost.mydomain/zope/manage, I can
> login to zope, but the whole idea with the rewrite rule was that zope
> should add /zope/ to the URL of all referenced files, but it does not.
> The same problem occurs when I try to logout of zope:
>
> The requested URL /manage_zmi_logout was not found on this server.
>
> Zope did not add /zope/ to the URL of the logout link. I can logout
> manually if I direct the browser to
> http://myhost.mydomain/zope/manage_zmi_logout.
>
> I am using Linux Mandrake 9.2/cooker, zope-2.7.0, apache-2.0.49. I have
> created a VHM in Zope and these are my rewrite rules for apache2:
>
> NameVirtualHost *
> <VirtualHost *>
> ServerName myhost.mydomain
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteLog "/var/log/apache2/rewrite_log"
> RewriteLogLevel 2
> RewriteRule ^/zope$ \
>
> http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHost
> Root/_vh_zope [L,P]
> RewriteRule ^/zope(.*) \
>
> http://localhost:9080/VirtualHostBase/http/%{SERVER_NAME}:80/VirtualHost
> Root/_vh_zope/$1 [L,P]
> RewriteRule ^/(.*) - [L]
> </IfModule>
> <IfModule mod_proxy.c>
> ProxyVia On
> # prevent the webserver from beeing used as proxy
> <LocationMatch "^[^/]">
> Deny from all
> </LocationMatch>
> </IfModule>
> </VirtualHost>
>
> Any help is appreciated!
>
> Johan
>
> --------------------------------
> Jim Kutter jim at ebizq.net
> Fri Apr 2 16:08:14 EST 2004
>
> 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
>
More information about the Zope
mailing list