-
-
Notifications
You must be signed in to change notification settings - Fork 271
How to configure APIs with nginx
Pliable Pixels edited this page Apr 16, 2018
·
2 revisions
nginx is another popular web server. The htaccess rules won't work with nginx as it does not use those files.
User jhmiller got the APIs to work with the following settings. He originally posted this settings here. If you are facing problems, you may want to track that thread for updates.
location /zm/cgi-bin {
gzip off;
alias /usr/lib/cgi-bin;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /zm {
gzip off;
alias /usr/share/zoneminder;
index index.php;
location ~ \.php$ {
if (!-f $request_filename) { return 404; }
expires epoch;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~ \.(jpg|jpeg|gif|png|ico)$ {
access_log off;
expires 33d;
}
location /zm/api/ {
alias /usr/share/zoneminder/api;
rewrite ^/zm/api(.+)$ /zm/api/index.php?p=$1 last;
}
}