<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kz</id>
	<title>ZoneMinder Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.staging.zoneminder.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Kz"/>
	<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/Special:Contributions/Kz"/>
	<updated>2026-04-19T17:43:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2174</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2174"/>
		<updated>2007-09-27T14:57:14Z</updated>

		<summary type="html">&lt;p&gt;Kz: Script-Version: 2007-09-27&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but mask it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  &amp;lt;nowiki&amp;gt;http://127.0.0.1:85;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS) appropriate (eg: &amp;lt;code&amp;gt;/zm/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be too hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Version:      2007-09-27&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.0 500 Internal Server Error&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;title&amp;gt;ERROR&amp;lt;/title&amp;gt;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
# (STDERR output is discarded as this confuses MPEG streaming clients)&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.0 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot; 2&amp;gt;/dev/null&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2173</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2173"/>
		<updated>2007-09-27T14:55:21Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Other use cases for zms-inetd */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but mask it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  &amp;lt;nowiki&amp;gt;http://127.0.0.1:85;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS) appropriate (eg: &amp;lt;code&amp;gt;/zm/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be too hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2005</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=2005"/>
		<updated>2007-06-14T19:20:49Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Make it transparent */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but mask it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  &amp;lt;nowiki&amp;gt;http://127.0.0.1:85;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS) appropriate (eg: &amp;lt;code&amp;gt;/zm/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Utilities&amp;diff=2004</id>
		<title>Utilities</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Utilities&amp;diff=2004"/>
		<updated>2007-06-14T19:20:19Z</updated>

		<summary type="html">&lt;p&gt;Kz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zms-inetd]] -- Inetd-wrapper for ZMS (Zoneminder Streaming Server), makes ZMS work &amp;quot;standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[ZM4MS]]&amp;lt;br&amp;gt; - Complete Windows GUI frontend for ZM (requires ZM!) (Please feel free to add to this anyone![James])&lt;br /&gt;
&lt;br /&gt;
[[zm4ms playback|ZM4MS playback with Mandriva 2006 livecd]]&lt;br /&gt;
&lt;br /&gt;
[[xlib_shm]] - allows you to view live streams from zm on local machine with low cpu usage&lt;br /&gt;
&lt;br /&gt;
[[zmxap]] - an xAP connector (to/from home automation applications)&lt;br /&gt;
&lt;br /&gt;
[[Voronwe ZM Frontend]] - Alternate web front end, with enhanced cron/calender integration.&lt;br /&gt;
&lt;br /&gt;
[[ICamviewRelay]] - a small app that allows the ICamview to be used with ZM&lt;br /&gt;
&lt;br /&gt;
[http://xoomer.alice.it/uxguerri/zoneminder.html intellinet550-relay] - a small daemon that allows old Intellinet IP cameras (550550) to be used with ZM. It can also be used to improve frame rate for new (550710) Intellinet IP camera model.&lt;br /&gt;
&lt;br /&gt;
[[ViewMAX]] - a quasi-branch of ZoneMinder, new interface and some added/modified functions&lt;br /&gt;
&lt;br /&gt;
[http://www.mythtv.org/wiki/index.php/MythZoneMinder MythZoneMinder] - a ZoneMinder plugin for MythTV to enable viewing ZM status, monitors, and events.&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1992</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1992"/>
		<updated>2007-05-31T15:40:23Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Make it transparent */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  &amp;lt;nowiki&amp;gt;http://127.0.0.1:85;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS) appropriate (eg: &amp;lt;code&amp;gt;/zm/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1991</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1991"/>
		<updated>2007-05-31T15:39:30Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Make it transparent */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  &amp;lt;nowiki&amp;gt;http://127.0.0.1:85;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1990</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1990"/>
		<updated>2007-05-31T15:38:52Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Zoneminder-Configuration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  http://127.0.0.1:85;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1989</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1989"/>
		<updated>2007-05-31T15:37:25Z</updated>

		<summary type="html">&lt;p&gt;Kz: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;lt;code&amp;gt;/usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;. Don&amp;#039;t forget to make it executable (&amp;lt;code&amp;gt;chmod 755 /usr/local/bin/zms-inetd&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  http://127.0.0.1:85;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1988</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1988"/>
		<updated>2007-05-31T15:35:49Z</updated>

		<summary type="html">&lt;p&gt;Kz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;#039;&amp;#039;/usr/local/bin/zms-inetd&amp;#039;&amp;#039;. Don&amp;#039;t forget to make it executable (chmod 755 /usr/local/bin/zms-inetd).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  http://127.0.0.1:85;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1987</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1987"/>
		<updated>2007-05-31T15:35:26Z</updated>

		<summary type="html">&lt;p&gt;Kz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;#039;&amp;#039;/usr/local/bin/zms-inetd&amp;#039;&amp;#039;. Don&amp;#039;t forget to make it executable (chmod 755 /usr/local/bin/zms-inetd).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  http://127.0.0.1:85;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!/bin/bash&lt;br /&gt;
#&lt;br /&gt;
# Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
#&lt;br /&gt;
# Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
# Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
# Requirements: bash, inetd&lt;br /&gt;
# License:      GNU General Public License, Version 2&lt;br /&gt;
#&lt;br /&gt;
# /etc/services:&lt;br /&gt;
#   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
#&lt;br /&gt;
# /etc/inetd.conf:&lt;br /&gt;
#   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
#&lt;br /&gt;
# ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
#   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
# configuration&lt;br /&gt;
ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# error handler&lt;br /&gt;
function errormsg {&lt;br /&gt;
  echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
  echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
  echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
  echo&lt;br /&gt;
  exit 1&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# read ZM configuration&lt;br /&gt;
[ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
. $ZMCONF&lt;br /&gt;
ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
[ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
# get request&lt;br /&gt;
read REQUEST&lt;br /&gt;
# skip headers&lt;br /&gt;
HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
# check request&lt;br /&gt;
[ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# split request&lt;br /&gt;
URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# check query&lt;br /&gt;
[ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
&lt;br /&gt;
# execute ZMS&lt;br /&gt;
export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
&amp;quot;$ZMS&amp;quot;&lt;br /&gt;
echo&lt;br /&gt;
exit 0&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1986</id>
		<title>Zms-inetd</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Zms-inetd&amp;diff=1986"/>
		<updated>2007-05-31T15:23:59Z</updated>

		<summary type="html">&lt;p&gt;Kz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;zms-inetd&amp;#039;&amp;#039;&amp;#039; is an [http://en.wikipedia.org/wiki/Inetd inetd]-wrapper for the ZMS (Zoneminder Streaming Server), so ZMS can work &amp;quot;standalone&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Author&amp;#039;&amp;#039;&amp;#039;: Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Inspiration&amp;#039;&amp;#039;&amp;#039;: http://www.debian-administration.org/articles/371&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;Requirements&amp;#039;&amp;#039;&amp;#039;: bash, inetd&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;License&amp;#039;&amp;#039;&amp;#039;: GNU General Public License, Version 2&lt;br /&gt;
&lt;br /&gt;
== Motivation ==&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;m using Zoneminder with [http://nginx.net/ Nginx Httpd], which doesnt support simple CGI (just FastCGI). So I needed a leightweight solution to make ZMS work without any extra software. This script depends only on inetd and bash.&lt;br /&gt;
&lt;br /&gt;
== Installation and Configuration ==&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
Just copy and paste the zms-inetd-script from below (Section &amp;quot;Script&amp;quot;) into a text file and save it, for example, as &amp;#039;&amp;#039;/usr/local/bin/zms-inetd&amp;#039;&amp;#039;. Don&amp;#039;t forget to make it executable (chmod 755 /usr/local/bin/zms-inetd).&lt;br /&gt;
&lt;br /&gt;
=== /etc/services ===&lt;br /&gt;
&lt;br /&gt;
As for every inetd-service you have to define a port number in /etc/services:&lt;br /&gt;
 zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
&lt;br /&gt;
=== /etc/inetd.conf ===&lt;br /&gt;
&lt;br /&gt;
Of course also an entry in the inetd configuration is needed. Please adapt this to your needs (user [= www], path):&lt;br /&gt;
 zms-inetd       stream tcp nowait    www   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
&lt;br /&gt;
=== Path to zm.conf ===&lt;br /&gt;
&lt;br /&gt;
Set the ZMCONF variable in the shell-script appropriate.&lt;br /&gt;
&lt;br /&gt;
=== Zoneminder-Configuration ===&lt;br /&gt;
&lt;br /&gt;
The last step is to adjust the web path (URL) to ZMS. This is done through the ZM-Webinterface &amp;gt; Options &amp;gt; Paths &amp;gt; Web path to zms streaming server (ZM_PATH_ZMS).  According to the configuration above this would be:&lt;br /&gt;
 http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
It doesn&amp;#039;t matter which path you specifiy as zms-inetd will always proxy to the ZMS cgi-binary for security reasons.&lt;br /&gt;
&lt;br /&gt;
== Further thoughts ==&lt;br /&gt;
&lt;br /&gt;
=== Make it transparent ===&lt;br /&gt;
&lt;br /&gt;
In combination with Nginx its propably useful not to point ZM directly to the zms-inetd port, but masq it with a reverse proxy configuration in Nginx.  That should avoid some problems if you want to reverse proxy the whole ZM installation (eg: from intranet to the internet).&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
  location /zm/zms-inetd {&lt;br /&gt;
    proxy_pass  http://127.0.0.1:85;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Of course you have to adjust the cgi-bin path (ZM_PATH_ZMS), for example, to /zm/zms-inetd.&lt;br /&gt;
&lt;br /&gt;
=== Other use cases for zms-inetd ===&lt;br /&gt;
&lt;br /&gt;
Another scenario where zms-inetd perhaps could also be used is a leightweight or embedded system, just running ZMS. For example the [http://busybox.net/ busybox] multibinary offers an inetd and a shell. Due the fact that zms-inetd is not heavily integrated with bash it should not be to hard to adapt it to ash (default shell in busybox).&lt;br /&gt;
&lt;br /&gt;
== Script ==&lt;br /&gt;
&amp;lt;source lang=&amp;quot;shell&amp;quot;&amp;gt;&lt;br /&gt;
 #!/bin/bash &lt;br /&gt;
 #&lt;br /&gt;
 # Inetd-wrapper for ZMS (Zoneminder Streaming Server)&lt;br /&gt;
 #&lt;br /&gt;
 # Author:       Kurt Zankl &amp;lt;kz@xon.uni.cc&amp;gt;&lt;br /&gt;
 # Inspiration:  http://www.debian-administration.org/articles/371&lt;br /&gt;
 # Requirements: bash, inetd&lt;br /&gt;
 # License:      GNU General Public License, Version 2&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/services:&lt;br /&gt;
 #   zms-inetd       85/tcp   # Zoneminder ZMS inetd-wrapper&lt;br /&gt;
 #&lt;br /&gt;
 # /etc/inetd.conf:&lt;br /&gt;
 #   zms-inetd       stream tcp nowait    www-data   /usr/local/bin/zms-inetd  zms-inetd&lt;br /&gt;
 #&lt;br /&gt;
 # ZM Options / Paths / Web path to zms streaming server:&lt;br /&gt;
 #   ZM_PATH_ZMS = http://&amp;lt;server&amp;gt;:85/&amp;lt;anypath&amp;gt;&lt;br /&gt;
 #&lt;br /&gt;
 &lt;br /&gt;
 # configuration&lt;br /&gt;
 ZMCONF=&amp;quot;/usr/local/etc/zm.conf&amp;quot;&lt;br /&gt;
 CGIBIN=&amp;quot;zms&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # error handler&lt;br /&gt;
 function errormsg {&lt;br /&gt;
   echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
   echo &amp;quot;Content-Type: text/html&amp;quot;&lt;br /&gt;
   echo&lt;br /&gt;
   echo &amp;quot;&amp;lt;h1&amp;gt;ERROR&amp;lt;/h1&amp;gt;&amp;quot;&lt;br /&gt;
   echo -e &amp;quot;&amp;lt;pre&amp;gt;$1&amp;lt;/pre&amp;gt;&amp;quot;&lt;br /&gt;
   echo&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # read ZM configuration&lt;br /&gt;
 [ -r $ZMCONF ] || errormsg &amp;quot;Error reading Zoneminder configuration \&amp;quot;$ZMCONF\&amp;quot;&amp;quot;;&lt;br /&gt;
 . $ZMCONF&lt;br /&gt;
 ZMS=&amp;quot;$ZM_PATH_CGI/$CGIBIN&amp;quot;&lt;br /&gt;
 [ -x $ZMS ] || errormsg &amp;quot;Error finding ZMS executable \&amp;quot;$ZMS\&amp;quot;&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 # get request&lt;br /&gt;
 read REQUEST&lt;br /&gt;
 # skip headers&lt;br /&gt;
 HEADER=&amp;quot;nothing&amp;quot;; while [ &amp;quot;$HEADER&amp;quot; != $&amp;#039;\r&amp;#039; -a -n &amp;quot;$HEADER&amp;quot; ]; do read HEADER; done&lt;br /&gt;
 # check request&lt;br /&gt;
 [ -z &amp;quot;$REQUEST&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Request is empty&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # split request&lt;br /&gt;
 URL=&amp;quot;${REQUEST#GET }&amp;quot;&lt;br /&gt;
 URL=&amp;quot;${URL% HTTP/*}&amp;quot;&lt;br /&gt;
 QUERY=&amp;quot;${URL#*\?}&amp;quot;&lt;br /&gt;
 URL=&amp;quot;${URL%%\?*}&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # check query&lt;br /&gt;
 [ &amp;quot;$QUERY&amp;quot; == &amp;quot;$URL&amp;quot; ] &amp;amp;&amp;amp; errormsg &amp;quot;Invalid query&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 # execute ZMS&lt;br /&gt;
 export QUERY_STRING=&amp;quot;$QUERY&amp;quot;&lt;br /&gt;
 echo &amp;quot;HTTP/1.1 200 OK&amp;quot;&lt;br /&gt;
 &amp;quot;$ZMS&amp;quot;&lt;br /&gt;
 echo&lt;br /&gt;
 exit 0&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
	<entry>
		<id>http://wiki.staging.zoneminder.com/index.php?title=Utilities&amp;diff=1985</id>
		<title>Utilities</title>
		<link rel="alternate" type="text/html" href="http://wiki.staging.zoneminder.com/index.php?title=Utilities&amp;diff=1985"/>
		<updated>2007-05-31T14:47:59Z</updated>

		<summary type="html">&lt;p&gt;Kz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[zms-inetd]] -- Inetd-wrapper for ZMS (Zoneminder Streaming Server), makes ZMS working &amp;quot;standalone&amp;quot;&lt;br /&gt;
&lt;br /&gt;
[[ZM4MS]]&amp;lt;br&amp;gt; - Complete Windows GUI frontend for ZM (requires ZM!) (Please feel free to add to this anyone![James])&lt;br /&gt;
&lt;br /&gt;
[[zm4ms playback|ZM4MS playback with Mandriva 2006 livecd]]&lt;br /&gt;
&lt;br /&gt;
[[xlib_shm]] - allows you to view live streams from zm on local machine with low cpu usage&lt;br /&gt;
&lt;br /&gt;
[[zmxap]] - an xAP connector (to/from home automation applications)&lt;br /&gt;
&lt;br /&gt;
[[Voronwe ZM Frontend]] - Alternate web front end, with enhanced cron/calender integration.&lt;br /&gt;
&lt;br /&gt;
[[ICamviewRelay]] - a small app that allows the ICamview to be used with ZM&lt;br /&gt;
&lt;br /&gt;
[http://xoomer.alice.it/uxguerri/zoneminder.html intellinet550-relay] - a small daemon that allows old Intellinet IP cameras (550550) to be used with ZM. It can also be used to improve frame rate for new (550710) Intellinet IP camera model.&lt;br /&gt;
&lt;br /&gt;
[[ViewMAX]] - a quasi-branch of ZoneMinder, new interface and some added/modified functions&lt;br /&gt;
&lt;br /&gt;
[http://www.mythtv.org/wiki/index.php/MythZoneMinder MythZoneMinder] - a ZoneMinder plugin for MythTV to enable viewing ZM status, monitors, and events.&lt;/div&gt;</summary>
		<author><name>Kz</name></author>
	</entry>
</feed>