Since the Lenya Wiki threw an error when I tried to register, I thought I'd contribute a write-up of how to set up Lenya behind Jetty 6 and Apache 2 here instead. If someone finds it useful enough to include in the documentation, go for it. The docs as they are now were a bit thin on this topic; there were a few cryptic mentions about Tomcat and stuff, but no proper how-to on setting up a production environment that I could find. So here goes.
Running Lenya 2 in Jetty 6 with Apache 2 While the standalone build of Lenya is good to get started with, it's not really good enough for most production uses. This how-to explains how you can set up Lenya under a more typical production configuration, using Jetty 6 and Apache 2. The example commands are from Debian-style Linux distros; replace with your own if you're not on one. (1) Set up the environment 1. Install Java 6 JDK from Sun. OpenJDK isn't fully compatible with Batik, the image processing library used in Lenya. # aptitude install sun-java6-jdk 2. Install Jetty. # aptitude install jetty 3. Install Apache 2. # aptitude install apache2 4. Make sun-java your default JVM. Go to JAVA_HOME, e.g. /usr/lib/jvm and # ln -s java-6-sun default-java 5. Test run Jetty. # /etc/init.d/jetty start ...and surf to localhost:8080. I had a problem with a misconfiguration out of the box; I had to comment out the line /etc/jetty/jetty-shared-webapps.xml in /usr/share/jetty/etc/jetty.conf. YMMV. (2) Set up Lenya 1. Build Lenya as per the instructions. Standalone or .war, doesn't matter. 2. Put lenya.war or [LENYA_SRC]/build/lenya/webapp under [JETTY_HOME]/webapps (rename webapp to lenya). 3. Copy or link [LENYA_SRC]/externals/cocoon_2_1_x/lib/endorsed/jakarta-regexp-1.5.jar under [JETTY_HOME]/lib/ext. Start Jetty and surf to http://locahost:8080/lenya/. You should see the Lenya homepage. (3) Set up the proxy directives: 1. Go to /etc/apache2/mods-enabled, and symlink to ../mods-available/proxy.load, ../mods-available/proxy.conf, and ../mods-available/proxy_http.load. 2. Add your proxy confs to /etc/apache2/mods-available/proxy.conf. Mine looks like this: --BEGIN-- <IfModule mod_proxy.c> # Turn off support for true Proxy behaviour as we are acting as # a transparent proxy ProxyRequests Off # Turn off VIA header as we know where the requests are proxied ProxyVia Off # Turn on Host header preservation so that the servlet container # can write links with the correct host and rewriting can be avoided. ProxyPreserveHost On # Set the permissions for the proxy <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> # Turn on Proxy status reporting at /status # This should be better protected than: Allow from all ProxyStatus On <Location /status> SetHandler server-status Order Deny,Allow Allow from all </Location> # Make the domain root go to the 'live' area of the HZC publication ProxyPass '' http://localhost:8080/lenya/hzc/live # Find the base resources used for authoring ProxyPass /lenya http://localhost:8080/lenya # Shorten the URL for authoring ProxyPass /authoring http://localhost:8080/lenya/hzc/authoring # Lenya sets a session cookie for /lenya, but we're actually at /authoring ProxyPassReverseCookiePath /lenya /authoring </IfModule> --END-- Note the ProxyPassReverseCookiePath directive -- you need one if you mess with the URI paths as above. If the LIVE area uses authentication, you'll need one for that too. 3. Configure your publication for these proxies. Edit [YOURPUB_HOME]/config/publication.xml and add the following to the <proxies> node: <proxy area="live" ssl="false" url="http://yourhost"/> <proxy area="authoring" ssl="false" url="http:/yourhost/lenya/yourpub/authoring"/> (Replace yourhost with your domain name and yourpub with your publication name, of course.) And that's about it, I think. Thanks for your help, everyone. Lenya is pretty nice when you get to know it, but the documentation makes it pret-ty intimidating... /Petteri --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
