View source | Discuss this page | Page history | Printable version   

Installation/Custom/Apache

Apache


Installing Apache on RedHat =

Install the Apache server package:

yum install httpd
yum install httpd-devel

Connector

Connect Apache and Tomcat using a connector. Tomcat recommends mod_jk for production environments. Look at the Tomcat documentation for installation instructions.

Installing mod_jk on RedHat

  1. Download the sources from mod_jk download page
  2. Uncompress it:
    tar xzvf tomcat-connectors-*-src.tar.gz
  3. Compile:
     ./configure --with-apxs=%(sbindir)s/apxs --with-apr-config=%(bindir)s/apr-config 
     make 
  4. For install, copy the 'apache-2.0/mod_jk.so' file into httpd/modules


mod_jk configuration

Edit the jk-workers.properties base on this configuration:

# workers.properties -
#
# This file provides jk derived plugins with the needed information to
# connect to the different tomcat workers.  Note that the distributed
# version of this file requires modification before it is usable by a
# plugin.
#

# The list of Tomcat workers
#
worker.list=ajp13


#------ DEFAULT ajp13 WORKER DEFINITION ------------------------------
#---------------------------------------------------------------------
#

# Defining a worker named ajp13 and of type ajp13
# Note that the name and the type do not have to match.
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
#
# Specifies the load balance factor when used with
# a load balancing worker.
# Note:
#  ----> lbfactor must be > 0
#  ----> Low lbfactor means less work done by the worker.
worker.ajp13.lbfactor=1

#
# Specify the size of the open connection cache.
#worker.ajp13.cachesize=10

Edit the mod_jk.conf file base on this configuration:

LoadModule jk_module    modules/mod_jk.so

JkWorkersFile   /etc/httpd/conf/jk-workers.properties

JkShmFile		/etc/httpd/logs/jk-runtime-status

JkLogFile       /var/log/httpd/mod_jk.log
JkLogLevel      info

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

JkRequestLogFormat "%w %V %T"

jkAutoAlias /var/lib/tomcat/webapps/
jkMount /openbravo* ajp13
jkMount /manager* ajp13
jkMount /OpenbravoDiagnostics* ajp13

Tomcat configuration

Now that apache connects to tomcat by the apj_13 port (8009) you can disable for security reasons the 8080 connector in server.xml file of tomcat configuration.

Also for security reasons configure the Tomcat Manager so only Openbravo can access to it, create a file in httpd/conf.d/ with these contents:

<Location /manager/>
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Location>

Openbravo configuration

Once it's installed and configured, update the Openbravo.properties files removing the tomcat (8080) port from the URLs, since apache uses the default (80) and it's not needed to be specified: context.url=http://localhost/openbravo tomcat.manager.url=http://localhost/manager

And to apply these changes, move to the OpenbravoERP-3.0MP22.2 directory in a command line terminal and run:

ant smartbuild

Compression

To reduce the needed bandwidth, one can use the mod_deflate Apache module. This compresses (gzip) HTML, XML, CSS and Javascript files (or any other filetype). We don't compress images because they already should be.

Edit httpd.conf and add the following lines:

LoadModule deflate_module                modules/mod_deflate.so

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
Header append Vary User-Agent env=!dont-vary

The LoadModule path may vary depending on the distribution.

Tomcat native

  1. Download the sources from tomcat native download page
  2. Uncompress it:
    tar xzvf tomcat-native-*-src.tar.gz
  3. Compile:
     configure --with-apr=%(bindir)s/apr-1-config --with-ssl=/usr' 
     make 
  4. Delete no necessary files:
    rm .libs/libtcnative-1.so
    rm .libs/libtcnative-1.so.0
  5. Install .libs/* into /usr/lib or /usr/local/lib
  6. Create these symlinks:
    ln -s %(libdir)s/libtcnative-1.so.0.1.%(upver)s %(libdir)s/libtcnative-1.so
    ln -s %(libdir)s/libtcnative-1.so.0.1.%(upver)s %(libdir)s/libtcnative-1.so.0
  7. Append "-Djava.library.path=%(libdir)s" to the CATALINA_OPTS.
  8. Restart Tomcat. At this moment it should not show this warning any more:
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/

Restart & Test

Restart Tomcat and Apache and test it in http://hostname/openbravo

sudo /etc/init.d/httpd restart
sudo /etc/init.d/tomcat restart


Installing Apache on Ubuntu =

Install the apache2 server package:

sudo apt-get install apache2 libapache2-mod-jk

Retrieved from "http://wiki.openbravo.com/wiki/Installation/Custom/Apache"

This page has been accessed 15,438 times. This page was last modified on 27 December 2011, at 10:53. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.