A full-featured, open source, state-of-the-art video surveillance software system.
Here's how to deploy it on FreeBSD 11.1 in a jail.
Update: I've upgraded ZoneMinder to 1.32.x and it broke everything. Here's the new setup.
Once the jail is deployed, modify the /etc/fstab.<jail>
file and include a RAM disk if desired:
tmpfs /usr/jails/zoneminder/tmpfs tmpfs rw,nosuid,mode=01777,size=2147483648 0 0
From within the jail, install the required packages:pkg install nginx fcgiwrap php56 php56-extensions zoneminder
Next, configure the services:rc.conf
:
fcgiwrap_enable="YES"
fcgiwrap_profiles="main"
fcgiwrap_main_socket="unix:/var/run/fcgiwrap/fcgiwrap.sock"
fcgiwrap_socket_owner="www"
fcgiwrap_socket_group="www"
fcgiwrap_main_user="www"
fcgiwrap_flags="-c 4"
nginx_enable="YES"
php_fpm_enable="YES"
zoneminder_enable="YES"
nginx.conf
(I have a TLS engine\proxy cache in front of all web services so this is not hosted with TLS):
user www;
worker_processes 1;
error_log /var/log/nginx/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
server_tokens off;
server {
listen 80;
server_name localhost;
root /usr/local/www/zoneminder;
try_files $uri $uri/ /index.php$is_args$args;
index index.php;
location = /cgi-bin/nph-zms {
gzip off;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/fcgiwrap/fcgiwrap.sock;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php-fpm.sock;
}
location /api {
rewrite ^/api/(.+)$ /api/index.php?p=$1 last;
}
}
}
zm.conf
(remote mysql service):
ZM_PATH_DATA=/usr/local/share/zoneminder
ZM_PATH_BIN=/usr/local/bin
ZM_PATH_LIB=/usr/local/lib
ZM_PATH_CONF=/usr/local/etc
ZM_PATH_WEB=/usr/local/www/zoneminder
ZM_PATH_CGI=/usr/local/www/zoneminder/cgi-bin
ZM_WEB_USER=www
ZM_WEB_GROUP=www
ZM_DB_TYPE=mysql
ZM_DB_HOST=X.X.X.X
ZM_DB_NAME=<name>
ZM_DB_USER=<user>
ZM_DB_PASS=<pass>
ZM_SERVER_HOST=
php-fpm.comf
[global]
pid = run/php-fpm.pid
[www]
user = www
group = www
listen = /var/run/php-fpm.socket
listen.owner = www
listen.group = www
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 500
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp