Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pre-requisites - Understanding your environment

The Opmantek VM Appliance is CentOS 6 and ships with Apache v2.2 


titleBest Practice Load Balancing

Of course your company may also have sophisticated proxying and load balanncing appliances already in place, in which case use those.

Where are all my Apache configuration files?


 ServerRoot              ::      /etc/httpd
 Primary Config Fle      ::      /etc/httpd/conf/httpd.conf
 Other Config Files      ::      /etc/httpd/conf.d
 Module Locations        ::      /usr/lib/httpd/modules
 DocumentRoot            ::      /var/www/html
 ErrorLog                ::      /var/log/httpd/error_log
 AccessLog               ::      /var/log/httpd/access_log
 cgi-bin                 ::      /var/www/cgi-bin (empty and disabled by default)
 binary                  ::      /usr/sbin/httpd
 runtime directory       ::      /etc/httpd/run
 start/stop              ::      /sbin/service httpd {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}


  1. There is an extra config file in /etc/sysconfig/httpd which can be used to change to the worker mpm /usr/sbin/httpd.worker. 

  2. Extra config files named *.conf are loaded from /etc/httpd/conf.d. This directory is used by packages like mod_python for drop-in configs 

  3. If you're having issues with authorization and your permissions are correct, you might have problems with SELinux permissions. Take a look at httpd_selinux(8) and related documentation. Particularly sealert(8) can be used for analysis and suggested solutions.

Debian Debian, Ubuntu (Apache httpd 2.x):

 ServerRoot              ::      /etc/apache2
 DocumentRoot            ::      /var/www
 Apache Config Files     ::      /etc/apache2/apache2.conf
                         ::      /etc/apache2/ports.conf
 Default VHost Config    ::      /etc/apache2/sites-available/default, /etc/apache2/sites-enabled/000-default
 Module Locations        ::      /etc/apache2/mods-available, /etc/apache2/mods-enabled
 ErrorLog                ::      /var/log/apache2/error.log
 AccessLog               ::      /var/log/apache2/access.log
 cgi-bin                 ::      /usr/lib/cgi-bin
 binaries (apachectl)    ::      /usr/sbin
 start/stop              ::      /etc/init.d/apache2 (start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean)



  1. The Debian/Ubuntu layout is fully documented in /usr/share/doc/apache2/README.Debian 

  2. Debian/Ubuntu use symlinks to configure vhosts and load modules. Configuration files are created in their respective sites-available and mods-available directories. To activate vhosts and modules, symlinks are created in the respective sites-enabled and mods-enabled directories to the config files in either sites-available and mods-available. Debian provides scripts to handle this process called 'a2ensite' and 'a2enmod' which activates vhosts and modules. 

  3. The default vhost is defined in /etc/apache2/sites-available/default, and overrides the DocumentRoot set in the server context.

Proxy Configuration on Opmantek VM - CentOS6 - Apache 2.2

We need to add several Vhosts entries for the proxying.  This means altering, adding deleting the configuration fies (that we found above).   We need to end up with vhost configuration entries for the localhost/Primary webservices and for the URLs proxied to the SlavesPollers.

The shipped 04proxy.conf file if you have one, should be removed and replaced with a new one as it will not work alongside new entries.   


We should replace that configuration file with a new which specifies the URLs used by the Primary and by the slavespollers.

Code Block
titleOMKproxy.conf example
##  Centos /etc/httpd/conf.d/OMK-proxy.conf
##  Debian /etc/apache2/sites-enabled/OMK-proxy.config

<IfModule mod_proxy.c>
ProxyRequests off
#LogLevel Debug
<IfModule mod_headers.c>
# if you are using the Opmantek applications behind an ssl-terminating apache vhost,
# then you should adjust the vhost configuration to add this header but with
# protocol "https".
# The Opmantek applications are location- and protocol-independent in almost all cases.
RequestHeader set X-Forwarded-Proto "http"
### As this is an older version of of Apache we first need to enable the NameVirtualHost and associate it to IP and port see
## In particular

NameVirtualHost *:80

## We can then specify the VirtualHosts and match to the required with ServerName {name} directive
<VirtualHost *:80>
## This should match the servername of the masterprimary.
    <Location "/omk">
        ProxyPass http://localhost:8042/omk retry=5
        ProxyPassReverse http://localhost:8042/omk
    <Location "/es">
        ProxyPass http://localhost:8042/es retry=5
        ProxyPassReverse http://localhost:8042/es
    <Location "/en">
        ProxyPass http://localhost:8042/en retry=5
        ProxyPassReverse http://localhost:8042/en
    <Location "/pt">
        ProxyPass http://localhost:8042/pt retry=5
        ProxyPassReverse http://localhost:8042/pt

## This section is only used if you are using this server as a MasterPrimary server which is proxying to slavespollers.
<VirtualHost *:80>
    ## This server ServerName should match 'host' entry in /usr/local/nmis8/conf/Servers.nmis
    ProxyRequests off
    ## This URL should point to the internal name of the poller server so this MasterPrimary can create it's own connection to the slavepoller
    ProxyPass / retry=5
    ProxyPassReverse /

## The second slavepoller again these should match what is in Servers.nmis
<VirtualHost *:80>
    ProxyRequests off
    ProxyPass / retry=5
    ProxyPassReverse /