Sep 072015


Jetty web server is a java based http server and servlet container, web servers are normally used for serving static content to client, nowadays jetty is used  for server to server communication, within large frameworks. Jetty is developed under open source license,part of Eclipse foundation, it is used in multiple active products such as Apache ActiveMQ,Alfresco, Apache Geronimo,Apache Maven, Apache Spark and also in open source project such as Hadoop, Eucalyptus and Red5.
Jetty supports the latest Java Servlet API as well as protocols SPDY and WebSocket, this guide will help you to set up jetty on CentOS 7 / RHEL 7.

Jetty requires java jdk, go ahead and install it.

#  yum -y install java-1.7.0-openjdk wget

Download latest version of jetty.

# wget

Extract the downloaded archive file to /opt

# tar zxvf jetty-distribution-9.2.5.v20141112.tar.gz -C /opt/

Rename it to jetty

# mv /opt/jetty-distribution-9.2.5.v20141112/ /opt/jetty

Create a user called jetty to run jetty web server on system start-up.

# useradd -m jetty

Change ownership of extracted jetty directory.

# chown -R jetty:jetty /opt/jetty/

Copy or Symlink to /etc/init.d directory to create a start up script file for jetty web server.

# ln -s /opt/jetty/bin/ /etc/init.d/jetty

Add script.

# chkconfig --add jetty

Auto start at 3,4 and 5 levels.

chkconfig --level 345 jetty on

Add the following information in /etc/default/jetty, replace port and listening address with your value.

vi /etc/default/jetty

Now start the jetty service.

service jetty start

Jetty can be accessed using web browser http://your-ip-address:8080.