Apace24 Zoneminder config

Hi,

I am configuring zoneminder and need to configure the web server interface in apache24. I already have apache24 configured up and running and is configured with the default 'it works' page, and viewvc for rancid. I just want to add zoneminder to the config and access it via /zoneminder.

The issue I have is that the 'pkg info -D zoneminder ' has a completely different syntax to my current apache24 httpd.conf config.

I need to add this to apache24 according to the install notes.
Code:
server {
        listen 80;

        root /usr/local/www/zoneminder;
        index index.php
        gzip off;

        location /cgi-bin/nph-zms {

            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_pass  unix:/var/run/fcgiwrap/fcgiwrap.sock;
        }

        location /zm/cache {

            alias /var/cache/zoneminder;
        }

        location /zm {

            alias    /usr/local/www/zoneminder;

            location ~ \.php$ {

                if (!-f $request_filename) { return 404; }
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                fastcgi_index index.php;
                fastcgi_pass unix:/var/run/php-fpm.sock;
            }

            location ~ \.(jpg|jpeg|gif|png|ico)$ {
                access_log    off;
                expires    33d;
            }

            location /zm/api/ {
                alias    /usr/local/www/zoneminder;
                rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last;
            }
        }
    }

My current config for viewvc in httpd.conf is as follows
Code:
<IfModule alias_module>
            ScriptAlias /cgi-bin/ "/usr/local/www/apache24/cgi-bin/"
            ScriptAlias /cgi/ "/usr/local/viewvc/bin/cgi/"
    </IfModule>

     <IfModule !wsgi_module>
           ScriptAlias "/viewvc" "/usr/local/viewvc/bin/cgi/viewvc.cgi"
     </IfModule>
     <IfModule wsgi_module>
           WSGIScriptAlias "/viewvc" "/usr/local/viewvc/bin/wsgi/viewvc.wsgi"
     </IfModule>
     <Location /viewvc>
             Options NONE +ExecCGI
             Require all granted 
             AddHandler cgi-script .cgi
             DirectoryIndex viewvc.cgi 
     </Location>


Full httpd.conf config (uncommented lines)
Code:
root@rancid:/home/rancid # grep -v '^ *#' /usr/local/etc/apache24/httpd.conf | grep -v '^$' | less
ServerRoot "/usr/local"
Listen 80
LoadModule mpm_prefork_module libexec/apache24/mod_mpm_prefork.so
LoadModule authn_file_module libexec/apache24/mod_authn_file.so
LoadModule authn_core_module libexec/apache24/mod_authn_core.so
LoadModule authz_host_module libexec/apache24/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache24/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache24/mod_authz_user.so
LoadModule authz_core_module libexec/apache24/mod_authz_core.so
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
LoadModule auth_basic_module libexec/apache24/mod_auth_basic.so
LoadModule reqtimeout_module libexec/apache24/mod_reqtimeout.so
LoadModule filter_module libexec/apache24/mod_filter.so
LoadModule mime_module libexec/apache24/mod_mime.so
LoadModule log_config_module libexec/apache24/mod_log_config.so
LoadModule env_module libexec/apache24/mod_env.so
LoadModule headers_module libexec/apache24/mod_headers.so
LoadModule setenvif_module libexec/apache24/mod_setenvif.so
LoadModule version_module libexec/apache24/mod_version.so
LoadModule unixd_module libexec/apache24/mod_unixd.so
LoadModule status_module libexec/apache24/mod_status.so
LoadModule autoindex_module libexec/apache24/mod_autoindex.so
<IfModule !mpm_prefork_module>
        LoadModule cgid_module libexec/apache24/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
        LoadModule cgi_module libexec/apache24/mod_cgi.so
</IfModule>
LoadModule dir_module libexec/apache24/mod_dir.so
LoadModule alias_module libexec/apache24/mod_alias.so
LoadModule php_module         libexec/apache24/libphp.so
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf
 
<IfModule unixd_module>
User www
Group www
</IfModule>
ServerAdmin [email]you@example.com[/email]
ServerName [URL="http://www.rancid.ciscokid.local.net:80"]www.rancid.ciscokid.local.net:80[/URL]
<Directory />
    AllowOverride none
    Require all denied
</Directory>
DocumentRoot "/usr/local/www/apache24/data"
<Directory "/usr/local/www/apache24/data">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
<Files ".ht*">
    Require all denied
</Files>
ErrorLog "/var/log/httpd-error.log"
LogLevel warn
<IfModule log_config_module>
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    <IfModule logio_module>
      LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
    </IfModule>
    CustomLog "/var/log/httpd-access.log" common
</IfModule>
<IfModule alias_module>
    ScriptAlias /cgi-bin/ "/usr/local/www/apache24/cgi-bin/"
    ScriptAlias /cgi/ "/usr/local/viewvc/bin/cgi/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/usr/local/www/apache24/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>
<IfModule headers_module>
    RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
    TypesConfig etc/apache24/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include etc/apache24/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include etc/apache24/Includes/*.conf
 <IfModule wsgi_module>
   WSGIRestrictSignal Off
 </IfModule>
 <IfModule !wsgi_module>
   ScriptAlias "/viewvc" "/usr/local/viewvc/bin/cgi/viewvc.cgi"
 </IfModule>
 <IfModule wsgi_module>
   WSGIScriptAlias "/viewvc" "/usr/local/viewvc/bin/wsgi/viewvc.wsgi"
 </IfModule>
 <Location /viewvc>
     Options NONE +ExecCGI
     Require all granted 
     AddHandler cgi-script .cgi
     DirectoryIndex viewvc.cgi 
 </Location>
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
(END)
 
Last edited by a moderator:
I found a sample config and have tried to port it, can anybody confirm if I am on the right track.
Code:
<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot "/usr/local/www/zoneminder"

    # Order matters. This alias must come first.
    Alias /zm/cache "/var/cache/zoneminder"
    <Directory "/var/cache/zoneminder">
        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 "/usr/local/www/zoneminder"
    <Directory "/usr/local/www/zoneminder">
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
        <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>

    # Remember to enable cgi mod (i.e. "a2enmod cgi").
    ScriptAlias /cgi-bin "/cgi-bin/nph-zms"
    <Directory "/cgi-bin/nph-zms">
        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>
 
Last edited by a moderator:
Back
Top