server {
        listen 80 default_server;
        server_name _;

        index index.php;

        location /zm/ {
                alias /usr/share/zoneminder/www/;
                location ~ \.php$ {
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_pass unix:/var/run/php5-fpm.sock;
                }
        }

        location = /zm/cgi-bin/nph-zms {
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME /usr/lib/zoneminder/cgi-bin/nph-zms;
                fastcgi_pass unix:/var/run/fcgiwrap.socket;
        }
}
