You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Petteri Sulonen <ps...@gmail.com> on 2010/02/21 14:16:59 UTC

Running Lenya 2 with Jetty 6 and Apache 2 -- a how-to

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: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Running Lenya 2 with Jetty 6 and Apache 2 -- a how-to

Posted by Petteri Sulonen <ps...@gmail.com>.
I tried registering again, and this time it worked. I'll write it up
myself later today or tomorrow.

/Petteri

On Mon, Feb 22, 2010 at 7:06 PM, Richard Frovarp <rf...@apache.org> wrote:
> Petteri Sulonen wrote:
>>
>> Cool. I'll try registering again later.
>>
>> I discovered a small error with the doc just after hitting Send; I
>> hope I'll be able to sort that out on the wiki directly. I could write
>> another "how-to" type doc that takes stuff a bit further from the
>> absolute "getting started" that's already up there.
>>
>> /Petteri
>>
>
> Do you want me to post what you sent, or do you want to try it later?
> Currently I've created a page here
> http://wiki.apache.org/lenya/HowToJettyInstall for the content to go.
>
> Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Running Lenya 2 with Jetty 6 and Apache 2 -- a how-to

Posted by Richard Frovarp <rf...@apache.org>.
Petteri Sulonen wrote:
> Cool. I'll try registering again later.
>
> I discovered a small error with the doc just after hitting Send; I
> hope I'll be able to sort that out on the wiki directly. I could write
> another "how-to" type doc that takes stuff a bit further from the
> absolute "getting started" that's already up there.
>
> /Petteri
>   
Do you want me to post what you sent, or do you want to try it later? 
Currently I've created a page here 
http://wiki.apache.org/lenya/HowToJettyInstall for the content to go.

Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Running Lenya 2 with Jetty 6 and Apache 2 -- a how-to

Posted by Petteri Sulonen <ps...@gmail.com>.
Cool. I'll try registering again later.

I discovered a small error with the doc just after hitting Send; I
hope I'll be able to sort that out on the wiki directly. I could write
another "how-to" type doc that takes stuff a bit further from the
absolute "getting started" that's already up there.

/Petteri

On Mon, Feb 22, 2010 at 6:26 PM, Richard Frovarp <rf...@apache.org> wrote:
> Petteri Sulonen wrote:
>>
>> 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.
>>
>
> Thanks for the documentation. I'm not sure why you would get an error when
> trying to register.
>
> I'll get the documentation up on the wiki, and it probably should be in part
> on the main site as well. We appreciate any and all documentation updates.
>
> Richard
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: Running Lenya 2 with Jetty 6 and Apache 2 -- a how-to

Posted by Richard Frovarp <rf...@apache.org>.
Petteri Sulonen wrote:
> 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.
>   
Thanks for the documentation. I'm not sure why you would get an error 
when trying to register.

I'll get the documentation up on the wiki, and it probably should be in 
part on the main site as well. We appreciate any and all documentation 
updates.

Richard

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org