martedì 19 ottobre 2010

Apache + Jetty su Ubuntu

1 scaricare apt-get install jetty

2 i file si trovano sotto /usr/share/jetty

3 configurare jetty sulla porta 8080 e abilitare dal suo file di configurazione /etc/init.d/default

4 configurare apache in modo che vada in proxy

<VirtualHost *>

        RewriteEngine On
        RewriteCond %{HTTP_HOST} !
        RewriteRule ^(.*)$$1 [R=301,L]

        <Proxy *>
        Order deny,allow
        Allow from all

        ProxyPreserveHost On
        ProxyPass /
        ProxyPassReverse /

        ErrorLog /usr/local/customers/logs/nomesito_error_logs
        CustomLog /usr/local/customers/logs/nomesito_access_logs combined


5 configurare jetty sotto /usr/share/jetty/etc/context/nomesito.xml

    <Configure class="org.mortbay.jetty.webapp.WebAppContext">

         <Call class="org.mortbay.log.Log" name="debug"><Arg>Configure  Sito</Arg></Call>
         <Set name="resourceBase">/usr/local/customers/nomesito/</Set>
         <Set name="contextPath">/</Set>
         <Set name="virtualHosts">
              <Array type="java.lang.String">

          <Call name="addHandler">
                 <New class="org.mortbay.jetty.handler.RequestLogHandler">
                  <Set name="requestLog">
                     <New id="RequestLogImpl" class="org.mortbay.jetty.NCSARequestLog">
                      <Arg><SystemProperty  name="jetty.logs" default="./logs"/>/yyyy_mm_dd.nomesito.request.log</Arg>
                           <Set name="retainDays">90</Set>
                           <Set name="append">true</Set>
                           <Set name="extended">false</Set>
                           <Set name="LogTimeZone">GMT</Set>


6 configurare il dns della macchina che punti al dominio interno sul file /etc/hosts

7 service jetty start && service jetty stop

2 commenti:

Marco Berri ha detto...

ops... il file di conf di jeyy si trova sotto /etc/default/jetty e NON sotto /etc/init.d/...

Marco Berri ha detto...

ecco il mio file
/etc/default/jetty (Modified)

# Defaults for jetty see /etc/init.d/jetty for more

# change to 0 to allow Jetty to start

# change to 'no' or uncomment to use the default setting in /etc/default/rcS

# Run Jetty as this user ID (default: jetty)
# Set this to an empty string to prevent Jetty from starting automatically

# Listen to connections from this network host
# Use as host to accept all connections.
# Uncomment to restrict access to localhost
#JETTY_HOST=$(uname -n)

# The network port used by Jetty

# Timeout in seconds for the shutdown of all webapps

# Additional arguments to pass to Jetty

# Extra options to pass to the JVM
#JAVA_OPTIONS="-Xmx256m -Djava.awt.headless=true"
JAVA_OPTIONS="-Xms1024M -Xmx1024M -Djava.awt.headless=true -XX:+UseParallelGC -XX:-DisableExplicitGC -XX:PerSize=256M -XX:MaxPermSize=256M -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

# Home of Java installation.

# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in /etc/default/jetty). Should contain a list of space separated directories.
#JDK_DIRS="/usr/lib/jvm/default-java /usr/lib/jvm/java-6-sun"

# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.

# Jetty uses a directory to store temporary files like unpacked webapps

# Jetty uses a config file to setup its boot classpath

# Default for number of days to keep old log files in /var/log/jetty/