check_logfiles: 3.7.5.1
[omd.git] / packages / apache-omd / APACHE_TCP_ADDR.hook
blob2a59b1a58421402c58ccd7bb7bacaab7765986ec
1 #!/bin/bash
3 # Alias: TCP host address for Apache
4 # Menu: Web GUI
5 # Description:
6 # Configure the TCP host address for the Apache webserver
7 # process of this site. This option is only useful if
8 # APACHE is set to "on" and WEBSERVER is set to "own".
10 # It might be useful to change the host address the site
11 # Apache webserver listes to.
13 # After changing this variable, the man Apache webserver
14 # must be restarted.
17 # Load other config options. This hook needs
18 # APACHE_TCP_PORT.
19 if [ -f $OMD_ROOT/etc/omd/site.conf ]; then
20 . $OMD_ROOT/etc/omd/site.conf
21 else
22 CONFIG_APACHE_TCP_PORT=${CONFIG_APACHE_TCP_PORT:-0}
25 case "$1" in
26 default)
27 echo "127.0.0.1"
29 choices)
30 echo "([a-z0-9-]+|(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3}))"
32 set)
33 APACHE_HOST=$2
34 cat <<EOF > $OMD_ROOT/etc/apache/listen-port.conf
35 # This file is managed by 'omd config set APACHE_TCP_PORT' and 'omd config set APACHE_TCP_ADDR'.
36 # Better do not edit manually
37 Listen $APACHE_HOST:$CONFIG_APACHE_TCP_PORT
38 EOF
39 cat <<EOF > $OMD_ROOT/etc/apache/proxy-port.conf
40 # This file is managed by 'omd config set APACHE_TCP_PORT' and 'omd config set APACHE_TCP_ADDR'.
41 # Better do not edit manually
42 <IfModule mod_proxy_http.c>
43 <Proxy http://$APACHE_HOST:$CONFIG_APACHE_TCP_PORT/$OMD_SITE>
44 Order allow,deny
45 allow from all
46 </Proxy>
48 <Location /$OMD_SITE>
49 # Setting "retry=0" to prevent 60 second caching of problem states e.g. when
50 # the site apache is down and someone tries to access the page.
51 # "disablereuse=On" prevents the apache from keeping the connection which leads to
52 # wrong devlivered pages sometimes
53 ProxyPass http://$APACHE_HOST:$CONFIG_APACHE_TCP_PORT/$OMD_SITE retry=0 disablereuse=On
54 ProxyPassReverse http://$APACHE_HOST:$CONFIG_APACHE_TCP_PORT/$OMD_SITE
55 </Location>
56 </IfModule>
57 EOF
59 depends)
60 [ "$CONFIG_APACHE_MODE" = own ]
62 esac