3 # Alias: TCP port number for Apache
6 # Configure the TCP port used 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 # After changing this variable, the man Apache webserver
13 # Load other config options. This hook needs
15 if [ -f $OMD_ROOT/etc
/omd
/site.conf
]; then
16 .
$OMD_ROOT/etc
/omd
/site.conf
18 CONFIG_APACHE_TCP_ADDR
=${CONFIG_APACHE_TCP_ADDR:-127.0.0.1}
23 # Scan for a free port number by looking at the
24 # configuration of the other sites...
25 PORT
=$
($OMD_ROOT/lib
/omd
/port_is_used APACHE_TCP_PORT
5000)
29 echo "[1-9][0-9]{0,4}"
32 PORT
=$
($OMD_ROOT/lib
/omd
/port_is_used APACHE_TCP_PORT
$2)
33 cat <<EOF > $OMD_ROOT/etc/apache/listen-port.conf
34 # This file is created by 'omd config set APACHE_TCP_PORT'.
35 # Better do not edit manually
36 Listen $CONFIG_APACHE_TCP_ADDR:$PORT
38 cat <<EOF > $OMD_ROOT/etc/apache/proxy-port.conf
39 # This file is created by 'omd config set APACHE_TCP_PORT'.
40 # Better do not edit manually
41 <IfModule mod_proxy_http.c>
42 <Proxy http://$CONFIG_APACHE_TCP_ADDR:$PORT/$OMD_SITE>
48 # Setting "retry=0" to prevent 60 second caching of problem states e.g. when
49 # the site apache is down and someone tries to access the page.
50 # "disablereuse=On" prevents the apache from keeping the connection which leads to
51 # wrong devlivered pages sometimes
52 ProxyPass http://$CONFIG_APACHE_TCP_ADDR:$PORT/$OMD_SITE retry=0 disablereuse=On
53 ProxyPassReverse http://$CONFIG_APACHE_TCP_ADDR:$PORT/$OMD_SITE
57 if [ "$PORT" != "$2" ] ; then
58 echo "Apache port $2 is in use. I've choosen $PORT instead." >&2
63 [ "$CONFIG_APACHE_MODE" = own
]