View source | Discuss this page | Page history | Printable version   
Main Page
Upload file
What links here
Recent changes

PDF Books
Add page
Show collection (0 pages)
Collections help





Installing Apache Http Server

The Apache Http Server is a very commonly used web-server.

In an Openbravo Installation for production use we recommend to have it running logically before the Tomcat server to take care of the following tasks:

Main steps for doing that independent of the OS are:

Installing Apache on Windows

The Apache Httpd project itself does not produce a binary installation for windows. However several external sites do.

For the rest of this guide we selected the Apache Lounge site for the following reasons:

Note: Choice of that binary provider is just an example and the user of this guide is in charge of maintaining & updating the installation. However this binaries seem to just work fine for Openbravo use while preparing this guide.

The concrete versions used for this guide were Apache 2.4.12 Win64 VC14 binaries and mod_jk-1.2.40-win64-VC14.

It is strongly recommended when using this guide to use the latest version available at that time as those written here will then most likely be outdated (and probably insecure as new security updates are made available regularly).

Basic Apache installation

This part describes the basic Apache Http server installation on windows to get it installed and running as a windows service.

cd C:\Apachet24\bin\
httpd -k install

Note: If the Apache service fails to start additionally to the usual logs/error.log file also check the Windows Event Log for the category Application. As some type of problem like errors in the configuration files will only be shown there.

Installing & Configuring mod_jk

jkMount /openbravo* node1
jkMount /manager* node1
jkMount /OpenbravoDiagnostics* node1
jkMountCopy all
Include conf/httpd-jk.conf
Include conf/openbravo.conf

Configuring compression

This configuration is technically optional but highly recommended.

Goal of it is to transparently compress outgoing data from the server to the client on the fly so that it has reduced size thus less bandwidth is used and the users get a better response time indirectly.

#LoadModule filter_module modules/
#LoadModule deflate_module modules/
<IfModule mod_deflate.c>
    # Apache standard
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/xml
    # added for Openbravo
    AddOutputFilterByType DEFLATE application/json
  1. Restart the Apache Http Server
  2. To test using either chrome developer tool or the Firefox Developer network tool verify the Transferred and Size column. Example for js-files there will be a noticeable reduction in transferred size compared to content size.

Configuring https/SSL

This section explain how to setup https/ssl handled via Apache.

All the necessary extra code + binaries are already included and the feature just need to be activated.

To activate the module for ssl edit the main conf/httpd.conf file and uncommented the following 3 lines:

#LoadModule socache_shmcb_module modules/
#LoadModule ssl_module modules/
#Include conf/extra/httpd-ssl.conf

Then edit the conf/extra/httpd-ssl.conf file to add your certificate related files. For example if you placed those into C:\Apache24\ssl then you will need to edit the following 3 lines to point them to your filenames:

SSLCertificateFile       C:\Apache24\ssl\<key-name>.pem
SSLCertificateKeyFile    C:\Apache24\ssl\<key-name>.key
SSLCertificateChainFile  C:\Apache24\ssl\<key-name>-ca.crt

For more information about those files please check the following page.

Possible conflicts with security systems

As said in Apache's Documentation, the AcceptFilter default configuration from apache can have conflicts with some security systems (spam, virus or spyware filters) in Windows. If this happens, these security systems can shutdown Apache, in these cases this additional configuration is needed:

AcceptFilter https none
AcceptFilter http none
EnableMMAP off

Installing Apache on RedHat

Bulbgraph.png   This part is community maintained only and may contain outdated information.

Install the Apache server package:

yum install httpd
yum install httpd-devel


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 
  4. For install, copy the 'apache-2.0/' file into httpd/modules

mod_jk configuration

Edit the base on this configuration:

# -
# 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

#------ 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.
# 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.

# Specify the size of the open connection cache.

Edit the mod_jk.conf file base on this configuration:

LoadModule jk_module    modules/

JkWorkersFile   /etc/httpd/conf/

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

Openbravo configuration

Once it's installed and configured, update the 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-#version# directory in a command line terminal and run:

ant smartbuild


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/
# As per mod_deflate.conf as shipped in Ubuntu 12.04 LTS 
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript
# To compress all dynamic i.e. DataSource replies
AddOutputFilterByType DEFLATE application/json

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' 
  4. Delete no necessary files:
    rm .libs/
    rm .libs/
  5. Install .libs/* into /usr/lib or /usr/local/lib
  6. Create these symlinks:
    ln -s %(libdir)s/ %(libdir)s/
    ln -s %(libdir)s/ %(libdir)s/
  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

Redirect / to /openbravo

There are many ways to do this redirect, a simple way to do it is creating an index.html with this content:

<META HTTP-EQUIV="Refresh" CONTENT="0; URL=openbravo">

Retrieved from ""

This page has been accessed 32,112 times. This page was last modified on 29 March 2016, at 13:55. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.