server { listen 443; rewrite ^/(.*)$ http://$host/$1 permanent; } server { listen 80; allow all; location / { root /usr/share/zoneminder/www; index index.php; } location /cgi-bin { root /usr/lib/zoneminder/cgi-bin; rewrite ^/cgi-bin/zm/(.*) /$1 break; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/spawn-fcgi/spw-cgi.sock; fastcgi_param SCRIPT_FILENAME /usr/lib/zoneminder/cgi-bin/$fastcgi_script_name; } location ~ /\.ht { deny all; } location ~ \.php$ { root /usr/share/zoneminder/www; rewrite ^/zm/(.*) /$1 break; include fastcgi_params; include sites-enabled.d/zm-fcgi.inc; fastcgi_param SCRIPT_FILENAME /usr/share/zoneminder/www/$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT /usr/share/zoneminder/www; } access_log /var/log/nginx/zoneminder-access.log; }