Versions Compared

Key

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

...

Note
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?

...

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/master Primary webservices and for the URLs proxied to the Slaves.

...

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

Code Block
themeEmacs
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"
</IfModule>
 
 
 
### As this is an older version of of Apache we first need to enable the NameVirtualHost and associate it to IP and port see https://httpd.apache.org/docs/2.2/vhosts/name-based.html
## In particular https://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost

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 master.
ServerName masterserver.example.com
    <Location "/omk">
        ProxyPass http://localhost:8042/omk retry=5
        ProxyPassReverse http://localhost:8042/omk
    </Location>
    <Location "/es">
        ProxyPass http://localhost:8042/es retry=5
        ProxyPassReverse http://localhost:8042/es
    </Location>
    <Location "/en">
        ProxyPass http://localhost:8042/en retry=5
        ProxyPassReverse http://localhost:8042/en
    </Location>
    <Location "/pt">
        ProxyPass http://localhost:8042/pt retry=5
        ProxyPassReverse http://localhost:8042/pt
    </Location>
</VirtualHost>

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

## The second slave again these should match what is in Servers.nmis
<VirtualHost *:80>
    ServerName external-name-poller-2.example.com
    ProxyRequests off
    ProxyPass / http://external-name-poller-2.example.com/ retry=5
    ProxyPassReverse / http://external-name-poller-2.example.com/
</VirtualHost>
</IfModule>

 

 

...