Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
New apache config for 1.31.42 up
#
# PLEASE NOTE THAT THIS FILE IS INTENDED FOR GUIDANCE ONLY AND MAY NOT BE APPROPRIATE FOR YOUR DISTRIBUTION
#
# This is for use with debian/ubuntu based distributions
#
# 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 "/usr/share/zoneminder/www"
# Order matters. This alias must come first.
Alias /zm/cache "/var/cache/zoneminder/cache"
# IF you aren't using /zm in the url to access ZM then uncomment the following line as well
# Alias /cache "/var/cache/zoneminder/cache"
<Directory "/var/cache/zoneminder/cache">
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>
ScriptAlias /zm/cgi-bin/ "/usr/lib/zoneminder/cgi-bin"
ScriptAlias /cgi-bin "/usr/lib/zoneminder/cgi-bin"
<Directory "/usr/lib/zoneminder/cgi-bin">
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>
Alias /zm "/usr/share/zoneminder/www"
<Directory "/usr/share/zoneminder/www">
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>
# 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>
# 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 /var/log/zm/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 /var/log/zm/apache-access.log combined
#CustomLog /var/log/httpd/zm-access.log combined
</VirtualHost>
@DaBooster1

This comment has been minimized.

Copy link

@DaBooster1 DaBooster1 commented May 1, 2018

Line 58 is buggy, needs to be split. apache will fail to start and complain with "expected </Directory> but saw </VirtualHost>" if not indented properly.
I am new to github so it's probably better if someone else performs the edit!

@knight-of-ni

This comment has been minimized.

Copy link

@knight-of-ni knight-of-ni commented May 3, 2018

"Alias /zm" must come after the ScriptAlias'. Otherwise the ScriptAlias will never match. You have to put the more specific Alias/ScriptAlias statements before the Alias/ScriptAlias statements with less specific url components.

See the following for the proper order: https://github.com/ZoneMinder/zoneminder/blob/master/distros/ubuntu1604/conf/apache2/zoneminder.conf

@bugui2007

This comment has been minimized.

Copy link

@bugui2007 bugui2007 commented Jun 15, 2018

Hello, just my 2 cents,
On line 47 it saids:

  • ScriptAlias /zm/cgi-bin/ /usr/lib/zoneminder/cgi-bin/
    and should be:
  • ScriptAlias /zm/cgi-bin/ "/usr/lib/zoneminder/cgi-bin"

Regards
Bugui

@connortechnology

This comment has been minimized.

Copy link
Owner Author

@connortechnology connortechnology commented Jun 21, 2018

I have applied the recommendations from the comments.

@pliablepixels

This comment has been minimized.

Copy link

@pliablepixels pliablepixels commented Jun 29, 2018

TheDocumentRoot in line 12 should be commented out. It is not needed and if we enable that it allows for loading the portal on "/" which breaks CSS

@spatnynick

This comment has been minimized.

Copy link

@spatnynick spatnynick commented Aug 14, 2018

both ScriptAlias lines must have trailing slash for me:
ScriptAlias /zm/cgi-bin/ "/usr/lib/zoneminder/cgi-bin"
->
ScriptAlias /zm/cgi-bin/ "/usr/lib/zoneminder/cgi-bin/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.