centos 安裝 jetty9,centosjetty9
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.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<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" class="org.eclipse.jetty.server.handler.RequestLogHandler">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<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