#
# ZoneMinder Apache configuration file
# With SSLRequire and HTTPS auto redirect
# Modify this configuration to suit your requirements
#

<Directory "/var/cache/zoneminder">
    SSLRequireSSL
    Options -Indexes +MultiViews +FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>


<Directory "/usr/share/zoneminder/www">
    # explicitly set index.php as the only directoryindex
    DirectoryIndex disabled
    DirectoryIndex index.php
    SSLRequireSSL
    Options -Indexes +MultiViews +FollowSymLinks
    #AddType application/x-httpd-php .php
    <FilesMatch .php>
        SetHandler "proxy:unix:/var/run/php-fpm/php74.sock|fcgi://localhost"
    </FilesMatch>
    AllowOverride All
    AuthName "Zoneminder"
    AuthType Basic
    AuthBasicProvider external
    AuthExternal pwauth
    require user admin
</Directory>

<Directory "/usr/libexec/zoneminder/cgi-bin">
    SSLRequireSSL
    AllowOverride None
    Options +ExecCGI +FollowSymLinks
    Require all granted
</Directory>

# For better visibility, the following directives have been migrated from the
# default .htaccess files included with the CakePHP project.
# Parameters not set here are inherited from the parent directive above.
<Directory "/usr/share/zoneminder/www/api">
   RewriteEngine on
   RewriteRule ^$ app/webroot/ [L]
   RewriteRule (.*) app/webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app">
   RewriteEngine on
   RewriteRule ^$ webroot/ [L]
   RewriteRule (.*) webroot/$1 [L]
   RewriteBase /zm/api
</Directory>

<Directory "/usr/share/zoneminder/www/api/app/webroot">
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
    RewriteBase /zm/api
</Directory>

