Note: I did have a whole set of extracts of my current Nginx config I was going to post here, but as a new user I can't get anything by the "Your post looks too spamy for a new user, please remove off-site URLs.", despite there being no off-site URLs within it - dunno what it's triggering on, but I had to remove all of it. Sorry for the lack of detail .
Basically I have an Nginx front-end webserver that proxy redirects various sub-directories of my domain to internal machines running their own webservers - these all work fine. However, I just can't get a working setup with Zoneminder.
Any advice on getting a working setup when reverse proxying from a front-end Nginx webserver to a internal Zoneminder, running with Apache, on an internal machine?
Any obvious gotchas?
Working reverse proxy setup from Nginx to zm Apache?
Re: Working reverse proxy setup from Nginx to zm Apache?
Right, I seem to be able to post some detail now...
Obviously that's not _internal_ip_ in reality in the below, it's the local IP of my internal Zoneminder machine (that I can't put in due to the "Spamy" filter) but here's the config I'm currently using for Nginx :
I'm using the above, in combination with a workaround I found on another forum that advises a mod to Zoneminder's index.php for ZM_BASE_URL :
Obviously that's not _internal_ip_ in reality in the below, it's the local IP of my internal Zoneminder machine (that I can't put in due to the "Spamy" filter) but here's the config I'm currently using for Nginx :
Code: Select all
location ^~ /zm {
proxy_pass _internal_ip_/zm;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Code: Select all
if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_HOST'] );
}
else
{
define( "ZM_BASE_URL", $protocol.'://'.$_SERVER['HTTP_X_FORWARDED_HOST'] );
}
Last edited by c128 on Sat Sep 14, 2013 9:57 pm, edited 1 time in total.
Re: Working reverse proxy setup from Nginx to zm Apache?
Now...although I can login to Zoneminder via _external_ip_/zm , the login sticks on the "Logging in" screen. If I manually refresh to _external_ip_/zm I get to the main screen listing my cams and I am logged in. However, if I click on a cam to monitor it live, the viewing screen opens within the same window (rather than popping up a new one) and live stream viewing doesn't work - Cambozola displays an exception with "Connection refused: connect".
"Options" seems to work but, again, opens with the same screen rather than popping up a new one.
Everything works fine when accessing Zoneminder directly, within my LAN, using _internal_ip/zm, so it's the reverse proxy from my front-end Nginx to my backend Zoneminder Apache that seems to be the problem.
I suspect I'm missing something obvious with proxy forwarding PHP related stuff or something, but none of the many tweaks I've tried gives me anything better than the above.
Anything obvious I can try here to get this reverse proxy working?
"Options" seems to work but, again, opens with the same screen rather than popping up a new one.
Everything works fine when accessing Zoneminder directly, within my LAN, using _internal_ip/zm, so it's the reverse proxy from my front-end Nginx to my backend Zoneminder Apache that seems to be the problem.
I suspect I'm missing something obvious with proxy forwarding PHP related stuff or something, but none of the many tweaks I've tried gives me anything better than the above.
Anything obvious I can try here to get this reverse proxy working?