- Published on
Setting up Zoneminder Multi Port with Nginx
- Authors
Introduction
If you're using the Zoneminder-base Docker image to run Zoneminder, and you're interested in using Multi Port, you might find that the Zoneminder Wiki Instructions, nor the regularly shared Multi-Port, Storage Areas and more article, don't work/apply.
This is because the Docker container uses nginx/php-fpm (ref) and not apache.
In this article I'll explain what steps you need to take to make this work.
Caveats
This is not an article on how to set-up Zoneminder and assumes you are using the Zoneminder-base image. It may apply to other scenarios, but I haven't personally tested it.
/etc/nginx
Copy the contents of The first step is to copy the contents of /etc/nginx
, so we can add our required additions. To do this run the following command:
docker cp zoneminder:/etc/nginx ./nginx
Replace ./nginx
with whatever path you want to store it to.
Map the local nginx directory
Under your volumes
section, map the local nginx directory to /etc/nginx
in your docker configuration
volumes:
# ...
- /path/to/nginx:/etc/nginx
Enable Multi Port
Enable Multi Port via the Zoneminder UI (see Multi-Port, Storage Areas and more for further details).
Add the required nginx configuration
For each port configuration, add a new server
block to nginx.conf
. For example, I have MIN_STREAMING_PORT
set to 30000
so for my camera an ID of 1, I add the following:
# Existing server block for port 80
server {
listen 80;
# ...
}
# The new server block to add
server {
listen 30001;
root /var/www/html;
gzip off;
location /cgi-bin/ {
root /zoneminder;
fastcgi_pass unix:/zoneminder/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_buffers 64 4K;
}
}
Map the required ports
Under your ports
section, map each port in your docker configuration
ports:
- 80:80
- 30001:30001
Restart
Run docker compose up -d
to add the new port configuration and reload the nginx configuration.
Your camera feed should now be viewable, using multi port.