Difference between revisions of "HowTos/Apache"
From Scalix Wiki
m (→Integrate On-The-Fly compression in Apache using mod_deflate) |
m (→Adjust Scalix settings) |
||
(29 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Scalix Wiki]] -> [[How-Tos]] -> '''Appache Integration''' | |
− | * For | + | |
+ | = 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. [[User:Leah|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 === | ||
<pre> | <pre> | ||
− | + | 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 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</pre> | </pre> | ||
− | + | === Create /etc/apache2/conf.d/scalix-jk-suse.conf === | |
<pre> | <pre> | ||
− | + | # | |
− | + | # 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> | ||
</pre> | </pre> | ||
− | + | === Adjust Scalix settings === | |
− | + | ||
− | + | ||
− | + | Edit the file '''/var/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 === | ||
− | |||
− | |||
<pre> | <pre> | ||
− | + | # | |
− | + | # 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.recycle_timeout=300 | ||
+ | |||
+ | </IfModule> | ||
</pre> | </pre> | ||
+ | |||
+ | === Create /etc/apache2/conf.d/scalix-jk-debian.conf === | ||
+ | |||
+ | <pre> | ||
+ | # | ||
+ | # 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> | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | === 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: | ||
+ | |||
+ | <pre> | ||
+ | <!--<Connector port="8080" | ||
+ | maxThreads="150" minSpareThreads="25" maxSpareThreads="75" | ||
+ | enableLookups="false" redirectPort="8443" acceptCount="100" | ||
+ | debug="0" connectionTimeout="20000" | ||
+ | disableUploadTimeout="true" />--> | ||
+ | </pre> | ||
+ | |||
+ | === 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 === | ||
+ | |||
+ | Then restart Tomcat, Scalix, and Apache2 with: | ||
+ | |||
+ | /etc/init.d/scalix-tomcat restart | ||
+ | /etc/init.d/scalix restart | ||
+ | /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 enable deflate module with: /usr/sbin/a2enmod deflate | ||
** Then restart Apache2 with /etc/init.d/apache2 restart | ** Then restart Apache2 with /etc/init.d/apache2 restart | ||
+ | <pre> | ||
+ | # Configure on-the-fly deflate compression of the pages: | ||
+ | <Location /> | ||
+ | AddOutputFilterByType DEFLATE text/xml text/html text/css | ||
+ | AddOutputFilterByType DEFLATE application/x-javascript | ||
+ | </Location> | ||
+ | </pre> | ||
+ | |||
+ | * For '''SuSE 10''' edit the /etc/sysconfig/apache2 and add "deflate" to the APACHE_MODULES-list. | ||
+ | ** Then restart Apache2. | ||
+ | |||
+ | |||
+ | * For '''Redhat''' / '''CentOS''': | ||
+ | ** Scalix 10 provides this functionality with the default install. See /etc/httpd/conf.d/scalix-deflate.conf and /etc/httpd/conf.d/scalix-0modules-redhat.conf --[[User:Wmchurch|Wmchurch]] 11:02, 19 October 2006 (PDT) |
Latest revision as of 15:05, 19 November 2008
Scalix Wiki -> How-Tos -> Appache Integration
Contents
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 /var/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.recycle_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:
<!--<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />-->
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
Then restart Tomcat, Scalix, and Apache2 with:
/etc/init.d/scalix-tomcat restart /etc/init.d/scalix restart /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 SuSE 10 edit the /etc/sysconfig/apache2 and add "deflate" to the APACHE_MODULES-list.
- Then restart Apache2.
- For Redhat / CentOS:
- Scalix 10 provides this functionality with the default install. See /etc/httpd/conf.d/scalix-deflate.conf and /etc/httpd/conf.d/scalix-0modules-redhat.conf --Wmchurch 11:02, 19 October 2006 (PDT)