Been at it for 2days and 2 nights now.
New User to ZoneMinder, but not to building web servers. I've built a few systems in the past for personal use (Nextcloud, Wekan, Matrix-Synapse Server, OpenProject) and now I'm building a ZoneMinder. The problem with this software is that there is a lot of conflicting information about settings. I'm posting here what I have to hopefully resolve a latest install.
FRESH WIPE. Just did a fresh install few minutes ago and things went smoother this time around. Something is up with my API validation and access to nph-zms for live streaming.
PROBLEMS
1. streaming from web page
2. ZMninja API can't validate
RUNNING:
ZM 1.34.16
Ubuntu 18.04 LTS
NGINX
MySQL
PHP7.3
SOME PARAMETERS I'VE RECENTLY SET
1. CGI-BIN OWNERSHIP. chown -R www-data:www-data /usr/lib/zoneminder/cgi-bin
2. ZM.CONF. Updated /etc/zm/zm.conf
Code: Select all
ZM_DB_PASS=
Code: Select all
# ZoneMinder url path to the zms streaming server
#ZM_PATH_ZMS=/zm/cgi-bin/nph-zms
ZM_PATH_ZMS=/cgi-bin/nph-zms
OPT_USE_AUTH - Yes
AUTH_RELAY - none
AUTH_HASH_SECRET - blank
AUTH_HASH_IPS - No
AUTH_HASH_LOGINS - No
5. CAMERA OUTPUT. Matches Codec & Resolution of what was shown in VLC.
1920x1080p
H264 Camera Passthrough
6. TIMEZONE. Set in Options > System > TIMEZONE within Zoneminder. Also set from previous install in php7.3-fpm.ini.
Other than that, besides some of the nuance settings like storage, save jpegs, everything is at default setting on the system and server.
I'm pretty sure it's a problem with my NGINX declration of cgi-bin and api. I'm not sure what I might be doing wrong. I decided to keep the entirety of my NGINX configuration in one file so that I can have one place to manage the NGINX configuration. See NGINX configuration below.
BELOW IS MY NGINX CONFIGURATION.
Code: Select all
server {
listen 80;
listen [::]:80;
server_name <domain.org> security.<domain.org>;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 444 ssl;
listen [::]:444 ssl;
server_name <domain.org> security.<domain.org>;
ssl_certificate /etc/letsencrypt/live/security.<domain.org>/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/security.<domain.org>/privkey.pem; # managed by Certbot
root /usr/share/zoneminder/www;
index index.php index.html index.htm index.nginx-debian.html;
try_files $uri $uri/ /index.php?$args =404;
location ~ \.php$ {
if (!-f $request_filename) { return 404; }
expires epoch;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param HTTP_PROXY "";
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
}
location /zm {
gzip off;
alias /usr/share/zoneminder/www;
try_files $uri $uri/ /index.php?$args =404;
index index.php;
}
location ~ /zm/api/(css|img|ico) {
auth_basic off;
rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break;
try_files $uri $uri/ =404;
}
location ~ \.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 33d;
}
access_log /var/log/nginx/security.<domain.org>-ACCESS.log;
error_log /var/log/nginx/security.<domain.org>-ERROR.log;
location /cgi-bin {
gzip off;
auth_basic off;
alias /usr/lib/zoneminder/cgi-bin;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /cgi-bin/nph-zms {
auth_basic off;
alias /usr/lib/zoneminder/cgi-bin/nph-zms;
}
location /zm/cache {
auth_basic off;
alias /var/cache/zoneminder/cache;
}
location ~* /zoneminder/.*\.(m4a|mp4|mov)$ {
mp4;
mp4_buffer_size 5M;
mp4_max_buffer_size 10M;
}
}