I have a couple of ZM servers in my internal network (both 1.34 and 1.36) and I'm trying to set a unified external access to them through a single ngnix-served entry point that would do all the SSL-ing, multiplexing and so on. What I'm looking to achieve is an external URL of https://external.server.com/zm-1 to be proxied to http://zm-1.internal.lan/zm and https://external.server.com/zm-2 to http://zm-2.internal.lan/zm.
I've managed to get some partial success but still struggling with a couple of problems. What I did so far was:
1) configure a location in nginx for both internal servers as follows:
Code: Select all
location ^~ /zm-1/ {
proxy_pass http://zm1-.internal.lan/zm/;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
}
location ^~ /zm-2/ {
proxy_pass http://zm2-.internal.lan/zm/;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
proxy_http_version 1.1;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
}
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
Is there any way to make ZM work properly through a reverse proxy without changing the php code or writing custom rewrite rules for links in html on the reverse proxy?