Apache2

From DarkWiki
Revision as of 08:48, 3 June 2017 by Apowney (talk | contribs) (Nagios proxy)
Jump to: navigation, search

Example configuration

Simple proxy

This example will receive HTTP requests headed towards HOSTNAME.darkmine.org, and will proxy them to the web server residing on 10.1.1.96 (port 3000). If URLs in the response have that internal IP (10.1.1.96:3000), they will be transformed to the "hostname.darkmine.org" version.

<VirtualHost *:80>
        ServerName HOSTNAME.darkmine.org
        ServerAdmin webmaster@localhost
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyPass "/" "http://10.1.1.96:3000/"
        ProxyPassReverse "/" "http://10.1.1.96:3000/"
</VirtualHost>

Nagios proxy

To proxy Nagios3, there are several parts that need to be proxied.

<VirtualHost *:80>
        ServerName nagios.darkmine.org
        ServerAdmin webmaster@localhost
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyPass /stylesheets/  http://10.1.1.97/nagios3/stylesheets/
        ProxyPassReverse /stylesheets/  http://10.1.1.97/nagios3/stylesheets/

        ProxyPass /images/  http://10.1.1.97/nagios3/images/
        ProxyPassReverse /images/  http://10.1.1.97/nagios3/images/

        ProxyPass /cgi-bin http://10.1.1.97/nagios3/cgi-bin
        ProxyPassReverse /cgi-bin http://10.1.1.97/nagios3/cgi-bin

        ProxyPass /js http://10.1.1.97/nagios3/js
        ProxyPassReverse /js http://10.1.1.97/nagios3/js

        ProxyPass /pnp4nagios3 http://10.1.1.97/pnp4nagios3
        ProxyPassReverse /pnp4nagios3 http://10.1.1.97/pnp4nagios3

        ProxyPass / http://10.1.1.97/nagios3/
        ProxyPassReverse / http://10.1.1.97/nagios3/

</VirtualHost>