nginx, zm and ubuntu

Discussions related to the 1.36.x series of ZoneMinder
Post Reply
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

nginx, zm and ubuntu

Post by Cramac1 »

Hello everyone. How to make install? something didn't work out
m3lab
Posts: 18
Joined: Mon Jul 14, 2014 9:41 pm

Re: nginx, zm and ubuntu

Post by m3lab »

Hi Cramac1.
I've a wotking installtion with nginx on Ubuntu ...

You can follow this wiki entry https://wiki.zoneminder.com/Ubuntu_Serv ... .2C_PHP.29 with few changes to use the 1.36 PPA and Ubuntu Focal

My best,
.m.
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: nginx, zm and ubuntu

Post by Cramac1 »

thx, its work.
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: nginx, zm and ubuntu

Post by Cramac1 »

api did not work:

Code: Select all

server {
    listen	80;
    server_name = video.ru;

location /zm/cgi-bin {
    gzip off;
    alias /usr/lib/zoneminder/cgi-bin;

    include /etc/nginx/fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $request_filename;
    fastcgi_pass  unix:/var/run/fcgiwrap.socket;
}
location /zm/cache {
auth_basic off;
        alias /var/cache/zoneminder/cache;
}
location ~ /zm/api/(css|img|ico) {
auth_basic off;
        rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break;
        #try_files $uri $uri/ =404;
}
location /zm {
#   if ($scheme ~ ^http:){
#       rewrite ^(.*)$  https://$host$1 permanent;
#   }

    gzip off;
    alias                   /usr/share/zoneminder/www;
    index                   index.php;

    location ~ \.php$ {
        if (!-f $request_filename) { return 404; }
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_param HTTP_PROXY "";
                fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~ \.(jpg|jpeg|gif|png|ico)$ {
        access_log          off;
        expires         33d;
    }
}


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/video.ru/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/video.ru/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

https://video.ru/zm/api/host/login.json
return 404 error
Cramac1
Posts: 111
Joined: Wed Aug 29, 2018 11:29 am

Re: nginx, zm and ubuntu

Post by Cramac1 »

work

Code: Select all

location /zm {
    gzip off;
    alias                   /usr/share/zoneminder/www;
    index                   index.php;

    location ~ \.php$ {
        if (!-f $request_filename) { return 404; }
                        include fastcgi_params;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        fastcgi_param HTTP_PROXY "";
                fastcgi_index index.php;
                        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
	
	location /zm/api/ {
	auth_basic off;
	alias                   /usr/share/zoneminder/www;
	        rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last;
	}

    location ~ \.(jpg|jpeg|gif|png|ico)$ {
        access_log          off;
        expires         33d;
    }
}
Post Reply