+----------------------------------------------------------------------------+ | | | Copyright 2004 The Apache Software Foundation. | | | | Licensed under the Apache License, Version 2.0 (the "License"); | | you may not use this file except in compliance with the License. | | You may obtain a copy of the License at | | | | http://www.apache.org/licenses/LICENSE-2.0 | | | | Unless required by applicable law or agreed to in writing, software | | distributed under the License is distributed on an "AS IS" BASIS, | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | | See the License for the specific language governing permissions and | | limitations under the License. | | | +----------------------------------------------------------------------------+ R E A D M E Contents -------- 1) Compile instructions 2) HTTPD configuration 3) Schema of Apache2 / mod_lenya / mod_proxy 4) Credits 5) TODOs 1) Compile instructions ----------------------- Compile and Install Apache 2 with mod_proxy enabled: cd ~/http-2.0.49 ./configure --prefix=/usr/local/httpd-2.0.49 --enable-proxy make make install /usr/local/httpd-2.0.49/bin/httpd -l Compile, Install and Append mod_lenya: /usr/local/httpd-2.0.49/bin/apxs -cia mod_lenya.c DEBUG: apxs -cia -D DDEBUG mod_lenya.c (you should then start httpd in debug mode: /usr/local/httpd-2.0.49/bin/httpd -X) 2) httpd.conf parameters: ------------------------- LoadModule lenya_module lib/apache/mod_lenya.so LenyaCacheDir "/lenya/pubs//work/cache/live" Prefix "/" Index "index.html" Logging On # Logging Off ProxyPass /cgi-bin/ ! # Read CSS and Images directly through Apache # Create softlinks within Apache htdocs: # mkdir -p lenya//live # cd lenya//live # ln -s /lenya/pubs//resources/shared/css css # ln -s /lenya/pubs//resources/shared/images images ProxyPass /lenya//live/css/ ! ProxyPass /lenya//live/images/ ! # Read CSS and Images through Lenya # ProxyPass /lenya//live/css/ http://127.0.0.1:8080/lenya//live/css/ # ProxyPassReverse /lenya//live/css/ http://127.0.0.1:8080/lenya//live/css/ # ProxyPass /lenya//live/images/ http://127.0.0.1:8080/lenya//live/images/ # ProxyPassReverse /lenya//live/images/ http://127.0.0.1:8080/lenya//live/images/ ProxyPass / http://127.0.0.1:8080//live/ ProxyPassReverse / http://127.0.0.1:8080//live/ 3) Schema of Apache2 with mod_proxy and mod_lenya: -------------------------------------------------- +---------------+ + + + Browser + + + +---------------+ +---------------------+ || |tomcat / jetty | || (1) | +-----------------+ | \/ | | cocoon | | +---------------->>-+ (2) | | +-------------+ | | | +-----------+ +-----------------+ | | | | | | | | mod_lenya |====>+ cache directory +<======| | | | | +-----------+ +-----------------+ | | | Lenya | | | | Apache 2 | || ====================> | | | | | \/ (3) // | | +-------------+ | | | +-----------+ // | +-----------------+ | | | mod_proxy |========// +---------------------+ | +-----------+ | | +-----------------<<+ (4) 1.) The httpd receives a client request 2.) mod_lenya looks up the requested uri in the cache directory, if a corresponding document is found, mod_lenya sends it back to the client instantly with ap_send_fd() and request processing stops here. 3.) when there is no match from mod_lenya, mod_proxy checks the uri against the configured rules, if a rule matches it passes the request over to the desired destination. 4.) when neither mod_lenya nor mod_proxy feel responsible for the request it continues its way through httpd. 4) Credits: ----------- Based on source code originally developed by Wyona (http://www.wyona.com) Gregor R. Imboden Michael H. Wechner 5) TODOs: --------- - Introduce a second cache which allows invalidating the first cache and (p)re-generating pages without dragging the performance down. that the web - Explore the combination with mod_mem_cache (http://httpd.apache.org/docs/2.0/mod/mod_cache.html) - Add alternatives such as for instance from Joerg Hohwiller: http://mail-archives.apache.org/mod_mbox/lenya-dev/200508.mbox/%3c4304B8EE.90405@j-hohwiller.de%3e ProxyRequests Off RewriteEngine On RewriteLog /var/log/apache/rewrite.log RewriteLogLevel 0! RewriteRule ^(.*) $1 [E=REQUEST_PATH:$1] RewriteCond %{DOCUMENT_ROOT}/%{ENV:REQUEST_PATH} -f RewriteRule ^(.*) %{DOCUMENT_ROOT}/%{ENV:REQUEST_PATH} [L] RewriteRule ^/$ index.html [R] RewriteRule ^/default/live/(.*)$ $1 [R,L] RewriteRule ^/(.*) http://localhost:8888/default/live/$1 [P] ProxyPassReverse / http://localhost:8888/