#
# PLEASE NOTE THAT THIS FILE IS INTENDED FOR GUIDANCE ONLY AND MAY NOT BE APPROPRIATE FOR YOUR DISTRIBUTION
#
# Sample configuration file for running ZoneMinder as name based virtual host
# Some values may need to manually adjusted to suit your setup
#
<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot "@WEB_PREFIX@"

    # Order matters. This alias must come first.
    Alias /zm/cache "@ZM_CACHEDIR@"
    <Directory "@ZM_CACHEDIR@">
        Options -Indexes +FollowSymLinks
        AllowOverride None
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>

    Alias /zm "@WEB_PREFIX@"
    <Directory "@WEB_PREFIX@">
        Options -Indexes +FollowSymLinks
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </Directory>

    ScriptAlias /cgi-bin "@CGI_PREFIX@"
    <Directory "@CGI_PREFIX@">
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        AllowOverride All
        <IfModule mod_authz_core.c>
           # Apache 2.4
           Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
            # Apache 2.2
            Order deny,allow
            Allow from all
        </IfModule>
    </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 "@ZM_WEBDIR@/api">
       RewriteEngine on
       RewriteRule ^$ app/webroot/ [L]
       RewriteRule (.*) app/webroot/$1 [L]
       RewriteBase /zm/api
    </Directory>

    <Directory "@ZM_WEBDIR@/api/app">
       RewriteEngine on
       RewriteRule ^$ webroot/ [L]
       RewriteRule (.*) webroot/$1 [L]
       RewriteBase /zm/api
    </Directory>

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

    # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    ErrorLog @ZM_LOGDIR@/apache-error.log
    #ErrorLog /var/log/httpd/zm-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    # Use the first option to have Apache logs written to the general log
    # directory, or the second to have them written to the regular Apache
    # directory (you may have to change the path to that used on your system)
    CustomLog @ZM_LOGDIR@/apache-access.log combined
    #CustomLog /var/log/httpd/zm-access.log combined

</VirtualHost>