header background

How to install Jetty and configure virtual host proxy

In this post installation of following components will be described:

Oracje JDK 1.8 for Armbian

There is an JDK for ARM processor available at Oracle download page. No JRE however… My orange Pi PC Plus is an 32-bit machine. If you have doubts about the version of your CPU find more info in this stackexchange thread. You can download the JDK with following command:

wget --header "Cookie: oraclelicense=accept-securebackup-cookie"  /

The installation procedure is fully described at DigitalOcean community tutorial.

Jetty installation

Installation procedure for Jetty may be found at Jetty 9.3.0.v20150612 documentation. Please check if there is new version of Jetty. As there is already Oracle JDK installed we don’t need to install OpenJDK 7.

Notes for Jetty installation

While configuring Jetty base directory you may want to add support for JSP and JSTL:

java -jar /opt/jetty/jetty-distribution-9.3.0.v20150612/start.jar  \

Please check /etc/default/jetty file. It should contain the line for JETTY_USER:


Be also aware that after copying Jetty script to /etc/init.d/jetty the proper command to check configuration is sudo service jetty check (there is an error in documentation).

If Jetty service fails to start please check the permissions for all Jetty folders.

Jetty logs are placed in Jetty base directory and therefore they should probably be linked at /var/log/jetty.

Apache HTTP virtual host proxy

For a proxy to Jetty server two modules need to be enabled:

user@pi:/opt# sudo a2enmod proxy
user@pi:/opt# sudo a2enmod proxy_http
user@pi:/opt# sudo service apache2 restart

The next thing we need is virtual host configuration. Let’s go into /etc/apache2/sites-available folder and create the file 010-jetty.conf with following content:

<VirtualHost *:80>
    ServerName jetty.pi.example.com
    ServerAlias www.jetty.pi.example.com
    ProxyRequests Off
    ProxyVia Block
    ProxyPreserveHost On
    CustomLog /var/log/apache2/jetty.pi.example.com-access.log combined
    ErrorLog /var/log/apache2/jetty.pi.example.com-error.log
    ProxyPass / http://localhost:8080/
    ProxyPassReverse / http://localhost:8080/

Then the new site needs to be enabled: sudo a2ensite (you will be asked which site to enable).

Although I did not need this, sometimes additional config may be needed for X-Forwarded-For header