Versions Compared

Key

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

...

Code Block
themeEmacs
titleOMKproxy.conf example
collapsetrue
##  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 NamedVirtualHost 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 *:*>
    ## This server ServerName should match 'host' entry in /usr/local/nmis8/conf/Servers.nmis
    ServerName external-name-poller-1.example.com
    
    ProxyRequests on
    ProxyHTMLDoctype XHTML
    ## 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 *:*>
    ServerName external-name-poller-2.example.com
    ProxyRequests on
    ProxyHTMLDoctype XHTML
    ProxyPass / http://external-name-poller-2.example.com/ retry=5
    ProxyPassReverse / http://external-name-poller-2.example.com/
</VirtualHost>
</IfModule>

...