你的位置:首页 > Java教程

[Java教程]centos 安装 jetty9


1、解压缩jetty9

cd /opt/app/jetty9
 
2、创建临时目录
mkdir tmp
 
3、修改jetty.sh ,添加如下:
 
JETTY_ARGS=jetty.port=8080
JAVA=/usr/java/jdk1.7.0_03/bin/java
JETTY_HOME=/opt/app/app-jetty
JETTY_BASE=$JETTY_HOME
JETTY_RUN=$JETTY_BASE
TMPDIR=$JETTY_HOME/tmp
JAVA_OPTIONS="-server -Xms1G -Xmx1G -Xmn500m -Xss256k -XX:MaxDirectMemorySize=100m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:NewSize=500m -XX:MaxNewSize=500m -XX:+UseParNewGC -XX:MaxTenuringThreshold=2 -XX:SurvivorRatio=8 -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=32768 -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+ParallelRefProcEnabled -XX:CMSFullGCsBeforeCompaction=5 -XX:+UseCMSCompactAtFullCollection -XX:+CMSClassUnloadingEnabled  -XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime -XX:-OmitStackTraceInFastThrow -Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=10.132.67.100 -Dcom.sun.management.jmxremote.port=18787 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/jvmlogs -Xloggc:/var/jvmlogs/app-heap_dump.log"
 
4、在webapps目录添加app. 
<?<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure >
  <Set name="contextPath">/app</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/app.war</Set>
  <Set name="tempDirectory"><SystemProperty name="jetty.home" default="."/>/tmp</Set>
  <Set name="persistTempDirectory">true</Set>
   <Set name="handler">
     <New id="RequestLog" >
       <Set name="requestLog">
          <New id="RequestLogImpl" >
            <Set name="filename"><Property name="jetty.logs" default="./logs"/>/yyyy_mm_dd.request.log</Set>
            <Set name="filenameDateFormat">yyyy_MM_dd</Set>
            <Set name="LogTimeZone">Asia/Shanghai</Set>
            <Set name="retainDays">60</Set>
            <Set name="append">true</Set>
          </New>
       </Set>
     </New>
  </Set>
</Configure>
 
 
5、把war放在webapps目录
 
6、jetty.sh restart