jetty

Jetty is a Java HTTP (Web) server and Java Servlet container. While Web Servers are usually associated with serving documents to people, Jetty is now often used for machine to machine communications, usually within larger software frameworks. Jetty is developed as a free and open source project as part of the Eclipse Foundation. The web server is used in products such as Apache ActiveMQ, Alfresco, Apache Geronimo, Apache Maven, Apache Spark, Google App Engine, Eclipse, FUSE, iDempiere, Twitter’s Streaming API and Zimbra. Jetty is also the server in open source projects such as Lift, Eucalyptus, Red5, Hadoop and I2P. Jetty supports the latest Java Servlet API (with JSP support) as well as protocols HTTP/2 and WebSocket.

This guide will help you to setup jetty on CentOS / RHEL

  • Install Java JDK as it is required to install and run Jetty
1
sudo yum install java-1.7.0-openjdk
1
wget http://download.eclipse.org/jetty/9.2.12.v20150709/dist/jetty-distribution-9.2.12.v20150709.tar.gz
  • Extract the downloaded tar.gz file to /opt directory
1
tar zxvf jetty-distribution-9.2.12.v20150709.tar.gz -C /opt/
  • Rename it to jetty
1
mv /opt/jetty-distribution-9.2.12.v20150709/ /opt/jetty
  • Create a user called jetty to run jetty web server on system startup
1
useradd -m jetty
  • Change ownership of extracted jetty directory
1
chown -R jetty:jetty /opt/jetty/
  • Copy or Symlink jetty.sh to /etc/init.d directory to create a start up script file for jetty web server
1
ln -s /opt/jetty/bin/jetty.sh /etc/init.d/jetty
  • Add script
1
chkconfig --add jetty
  • Auto start at 3,4 and 5 levels
1
chkconfig --level 345 jetty on
  • Add the following information in /etc/default/jetty, replace port and listening address with your value
1
2
3
4
5
6
7
vi /etc/default/jetty

 JETTY_HOME=/opt/jetty
 JETTY_USER=jetty
 JETTY_HOST=0.0.0.0
 JETTY_LOGS=/opt/jetty/logs/
 JETTY_ARGS=jetty.port=8080
  • Now start jetty service
1
service jetty start
  • Jetty can be accessed using web browser at http://your-ip-address:8080

References:
https://en.wikipedia.org/wiki/Jetty_(web_server)
http://www.eclipse.org/jetty/