cgi - How do I interpret URLs without extension as files rather than missing directories in nginx? -
so i'm trying install zoneminder , have run under nginx, has few compiled files need run using fast-cgi. these files lack extension.
if file has extension, there no issue , nginx interprets file , return 404 if can't find it. if has no extension, assume it's directory , return 404 when can't find sort of index page.
here have now:
# security camera domain. server { listen 888; server_name mydomain.com; root /srv/http/zm; # enable php support. include php.conf; location / { index index.html index.htm index.php; } # enable cgi support. location ~ ^/cgi-bin/(.+)$ { alias /srv/cgi-bin/zm/; fastcgi_pass unix:/run/fcgiwrap.sock; fastcgi_param script_filename $document_root/$1; include fastcgi.conf; } }
the idea is, under cgi-bin directory goes through fastcgi pipe.
any idea on howi can fix this?
upon closer inspection, realized zoneminder has 2 cgi scripts (nph-zms, zms), easier explicitly state them in nginx so:
# enable cgi support. location ~ ^/cgi-bin/(nph-zms|zms)$ { alias /srv/cgi-bin/zm/; fastcgi_pass unix:/run/fcgiwrap.sock; fastcgi_param script_filename $document_root/$1; include fastcgi.conf; }
seems best way go :)
Comments
Post a Comment