Initially I was running XWiki on Tomcat web server, which was communicating with HTTPD using AJP protocol, because it worked better with a subdomain. However, since there is limited memory on my VPS and the application seemed a bit slow and I was getting annoying HTTP 503 errors sometimes, I started looking for alternatives.
Jetty is a lightweight Java servlet container known for low memory footprint, so I decided to give it a go. Below is the configuration that worked for me.
I run jetty with default Debian configuration, except for memory – I have set 300M heap and 128M permgen size.
JAVA_OPTIONS="-Djava.awt.headless=true -Xmx300m -XX:MaxPermSize=128m -Djava.library.path=/usr/lib"
I like to run my applications in separate subdomains, so I created a file in /etc/apache2 for xwiki subdomain. Here are its most critical parts.
ProxyPass /xwiki/ http://localhost:8080/xwiki/ timeout=120 Keepalive=On
ProxyPassReverse /xwiki/ http://xwiki.loomchild.net/xwiki/
ProxyPass / http://localhost:8080/xwiki/ timeout=120 Keepalive=On
ProxyPassReverse / http://xwiki.loomchild.net/xwiki/
Now XWiki runs noticeably faster than in previous configuration. I was setting it up few months ago, so perhaps I missed some configuration details. If my tips do not work for you, please let me know.