Install Jetty as Web Server on Linux

  • Posted on: 15 May 2014
  • By: oon
Jetty as Independent Servlet Container

Commonly I use Jetty as embedded web server in Java application, but what if we want to use Jetty as independent web server (servlet container) on Linux operating system?

First of all, of course install Java on Linux, I prefer to use Oracle's version of JDK [3].

Download and extract Jetty [4], for example extract to directory /usr/local/jetty.


adduser -r -m jetty
chown -R jetty:jetty /usr/local/jetty
cd /etc/init.d
ln -s /usr/local/jetty/bin/jetty.sh jetty
chkconfig --add jetty
chkconfig --level 345 jetty on

Add some extra configurations:


JAVA_HOME=/usr/java/default #<-- your location to java
JAVA=$JAVA_HOME/bin/java
JAVA_OPTIONS=" -server -Xms256m -Xmx1024m -XX:+DisableExplicitGC "
JETTY_HOME=/usr/local/jetty
JETTY_USER=jetty
JETTY_PORT=8080 #<-- port number change if you need to
JETTY_HOST=0.0.0.0 #<--- If you don't set this to 0.0.0.0, jetty only listen on localhost
JETTY_LOGS=/usr/local/jetty/logs/

Start your jetty web server:

service jetty start

Now you can deploy your java web app! :)

[1]http://techtraits.com/jetty9install/
[2]http://www.copper-arrow.com/blog/jetty-web-server-centos-6
[3]http://www.oracle.com/technetwork/java/javase/downloads/index.html
[4]http://www.eclipse.org/jetty/downloads.php

Tags: 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.