Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@evandhoffman
Last active December 28, 2023 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save evandhoffman/71f8245634468eab48a9dbf0f7f44b8b to your computer and use it in GitHub Desktop.
Save evandhoffman/71f8245634468eab48a9dbf0f7f44b8b to your computer and use it in GitHub Desktop.
Ubuntu Nginx Zoneminder php-fpm config

Zoneminder provides instructions for setting up Zoneminder on Ubuntu, but they assume you're using Apache: https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.30.0_the_easy_way

I've moved away from Apache for webserving and wanted to see if there was a way to configure Zoneminder to work using Nginx and php-fpm. After a lot of trial and error I got it working. Include the snippet above in your nginx config to get it working at http:///zoneminder/ .

location ~ ^/zoneminder/(.+\.php)(.*)$ {
root /usr/share/zoneminder/www/;
fastcgi_split_path_info ([^/]+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
include /etc/nginx/fastcgi_params;
}
location /zoneminder/ {
alias /usr/share/zoneminder/www/;
index index.php;
}
location = /zoneminder/cgi-bin/nph-zms {
root /usr/lib/;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/zoneminder/cgi-bin/nph-zms;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment