Difference between revisions of "HowTos/Apache"

From Scalix Wiki
Jump to: navigation, search
(Debian)
(Other adjustments)
Line 172: Line 172:
 
</pre>
 
</pre>
  
=== Other adjustments ===
+
=== Adjust Tomcat Settings (optional) ===
 +
 
 +
You should disable port 8080 in Tomcat (optional but recommended).  Edit the file '''/opt/scalix-tomcat/conf/server.xml''' and comment out the line that starts with:
 +
 
 +
<Connector port="8080"...
 +
 
 +
using XML style comments like:
 +
 
 +
    <!--<Connector port="8080"
 +
              maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
 +
              enableLookups="false" redirectPort="8443" acceptCount="100"
 +
              debug="0" connectionTimeout="20000"
 +
              disableUploadTimeout="true" />-->
 +
 
 +
=== Adjust Scalix Settings ===
  
** You should disable port 8080 in Tomcat (optional but recommended):
 
*** edit the file '''/opt/scalix-tomcat/conf/server.xml''':
 
**** comment out the line that starts with '<Connector port="8080"...' using XML style comments
 
 
** edit the file '''/etc/opt/scalix/res/config/res.properties''':
 
** edit the file '''/etc/opt/scalix/res/config/res.properties''':
 
*** change 'res.tomcat.tcp.port=8080' to match your Apache port number (default is 80)                                   
 
*** change 'res.tomcat.tcp.port=8080' to match your Apache port number (default is 80)                                   
 +
 +
 +
 
** Then restart Tomcat with /etc/init.d/scalix-tomcat restart
 
** Then restart Tomcat with /etc/init.d/scalix-tomcat restart
 
** Also restart Scalix with /etc/init.d/scalix restart
 
** Also restart Scalix with /etc/init.d/scalix restart

Revision as of 23:58, 7 April 2006

Integrate Apache with Tomcat using mod_jk

SUSE (10.0) using SUSE's tomcat5 package

Notes 
This should work assuming you actually installed the SUSE tomcat5 package for use with Scalix. I'm not sure it would work with tomcat5 just uncompressed in a directory, as is recommended in the default installation instructions for CE RAW. See my SUSE 10.0 SC RAW Notes. Please improve these notes and example configs, I may be too permissive here, but it seems to work with these settings for me. Leah 16:52, 7 April 2006 (PDT)

Initial Setup

  • Obviously, you must install the jakarta module for apache. For SUSE, the package is mod_jk-ap20.
  • Enable the jk module to load in your apache configuration by editing the file /etc/sysconfig/apache and adding jk to the end of the APACHE_MODULES list in that file.

Create /etc/tomcat5/base/workers.properties

workers.tomcat_home=/usr/share/tomcat5
workers.java_home=/usr/lib/jvm/java
ps=/
worker.list=ajp12, ajp13, jboss
worker.ajp12.port=8007
worker.ajp12.host=localhost
worker.ajp12.type=ajp12
worker.ajp12.lbfactor=1
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.jboss.port=8809
worker.jboss.host=localhost
worker.jboss.type=ajp13
worker.jboss.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp12, ajp13, jboss
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$(ps)tomcat.jar
worker.inprocess.cmd_line=start
worker.inprocess.jvm_lib=$(workers.java_home)$(ps)jre$(ps)lib$(ps)i386$(ps)server$(ps)libjvm.so
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)logs$(ps)inprocess.stderr

Create /etc/apache2/conf.d/scalix-jk-suse.conf

#
# Scalix JK connector configuration
# (Specific to SUSE 10.0)
#
# Setup JK connector needed to run Tomcat under Apache server:
#
<IfModule mod_jk.c>
        JkWorkersFile   /etc/tomcat5/base/workers.properties
        #
        # Log settings
        #
        JkLogLevel      info
        JkLogFile       /var/log/apache2/mod_jk.log
        JkRequestLogFormat "%w %V %T"
        JkLogStampFormat   "[%a %b %d %H:%M:%S %Y] "
        # JkOptions indicate to send SSL KEY SIZE,
        JkOptions          +ForwardKeySize +ForwardURICompat -ForwardDirectories
        #
        # Send everything for context /examples to worker named ajp13 (ajp13)
        #
        JkMount /webmail/*      ajp13
        JkMount /sac/*          ajp13
        JkMount /caa*           ajp13
        JkMount /webcal*        ajp13
        JkMount /res*           ajp13
        #
        # Directory access for webapps
        #
        <Directory "/srv/www/tomcat5/base/webapps">
                Options Indexes FollowSymLinks
                AllowOverride all
                Order allow,deny
                Allow from all
        </Directory>
        #
        # Aliases for webapps
        #
        Alias /sac "/srv/www/tomcat5/base/webapps/sac"
        Alias /webmail "/srv/www/tomcat5/base/webapps/webmail"
        #Alias /webcal "/srv/www/tomcat5/base/webapps/webcal"
        #Alias /caa "/srv/www/tomcat5/base/webapps/caa"
        #Alias /res "/srv/www/tomcat5/base/webapps/res"

</IfModule>

Adjust Scalix settings

Edit the file /etc/opt/scalix/res/config/res.properties:

change

res.tomcat.tcp.port=8080

to match your Apache port number (default is 80)

res.tomcat.tcp.port=80

Restart services

rctomcat5 restart
/etc/init.d/scalix restart
rcapache2 restart

Debian

Create /etc/apache2/conf.d/scalix-jk-common.conf

#
# Scalix JK connector configuration
# (file common to all platforms)
#

# Setup JK connector needed to run Tomcat under Apache server:

<IfModule mod_jk.c>

# Set the jk log level [debug/error/info]
JkLogLevel          info

# Select the log format
JkLogStampFormat   "[%a %b %d %H:%M:%S %Y] "

# JkOptions indicate to send SSL KEY SIZE,
JkOptions          +ForwardKeySize +ForwardURICompat -ForwardDirectories

# JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"

# Send everything for context /examples to worker named worker1 (ajp13)
JkMount            /webmail* worker1
JkMount            /sac* worker1
JkMount            /caa* worker1
JkMount            /webcal* worker1
JkMount            /res* worker1

# workers.properties content:

# Define 1 real worker using ajp13
JkWorkerProperty worker.list=worker1

# Set properties for worker1 (ajp13)
JkWorkerProperty worker.worker1.type=ajp13
JkWorkerProperty worker.worker1.host=localhost
JkWorkerProperty worker.worker1.port=8009
JkWorkerProperty worker.worker1.lbfactor=50
JkWorkerProperty worker.worker1.cachesize=10
JkWorkerProperty worker.worker1.cache_timeout=600
JkWorkerProperty worker.worker1.socket_keepalive=1
JkWorkerProperty worker.worker1.reclycle_timeout=300

</IfModule>

Create /etc/apache2/conf.d/scalix-jk-debian.conf

#
# Scalix JK connector configuration
# (file specific to Debian platforms)
#

<IfModule mod_jk.c>
# Where to put jk logs
JkLogFile     /var/log/apache2/mod_jk.log
</IfModule>

Adjust Tomcat Settings (optional)

You should disable port 8080 in Tomcat (optional but recommended). Edit the file /opt/scalix-tomcat/conf/server.xml and comment out the line that starts with:

<Connector port="8080"...

using XML style comments like:


Adjust Scalix Settings

    • edit the file /etc/opt/scalix/res/config/res.properties:
      • change 'res.tomcat.tcp.port=8080' to match your Apache port number (default is 80)


    • Then restart Tomcat with /etc/init.d/scalix-tomcat restart
    • Also restart Scalix with /etc/init.d/scalix restart
    • Finally restart Apache2 with /etc/init.d/apache2 restart



  • For Redhat, more to come ;)

Integrate On-The-Fly compression in Apache using mod_deflate

  • For Debian, create the following file /etc/apache2/conf.d/scalix-deflate.conf as per file below:
    • Then enable deflate module with: /usr/sbin/a2enmod deflate
    • Then restart Apache2 with /etc/init.d/apache2 restart
# Configure on-the-fly deflate compression of the pages:
<Location />
  AddOutputFilterByType DEFLATE text/xml text/html text/css
  AddOutputFilterByType DEFLATE application/x-javascript
</Location>



  • For Redhat, more to come ;)