# gentoo apache2 vhost include file ServerAdmin webmaster@localhost DocumentRoot "%ZM_WEBDIR%" ## if zoneminder is the only thing on this named vhost you might want to ## redirect root / to /zm/ so you don't have to remember to type the path #RedirectMatch ^/$ /zm/ # Order matters. This alias must come first. Alias /zm/cache "/var/cache/zoneminder" Options -Indexes +FollowSymLinks AllowOverride None Require all granted # BEGIN api/v3 # API v3: www-misc/zm-api on 127.0.0.1:8080, uncommented by USE=apiv3. Needs # mod_proxy, mod_proxy_http and mod_proxy_wstunnel (APACHE2_OPTS -D PROXY), # and mod_headers. zm-api serves /api/v3, /api-docs and /swagger-ui; these map # them under /zm (the API document also as /zm/api-docs/v3/), and # APP_SERVER__PUBLIC_PREFIX=/zm (zm-api.env) puts /zm in the links it writes. # /zm/api-docs/ itself, and v2/ (USE=apiv2-php), are static files under /zm. # zm-api keys its login rate limit on the first X-Forwarded-For address, so # drop the client's before mod_proxy adds the peer. # # ProxyPreserveHost On # ProxyPass /zm/api/v3/ http://127.0.0.1:8080/api/v3/ upgrade=websocket # ProxyPassReverse /zm/api/v3/ http://127.0.0.1:8080/api/v3/ # ProxyPass /zm/api-docs/openapi.json http://127.0.0.1:8080/api-docs/openapi.json # ProxyPass /zm/api-docs/v3/openapi.json http://127.0.0.1:8080/api-docs/openapi.json # RedirectMatch ^/zm/api-docs/v3/$ /zm/swagger-ui/ # ProxyPass /zm/swagger-ui http://127.0.0.1:8080/swagger-ui # ProxyPassReverse /zm/swagger-ui http://127.0.0.1:8080/swagger-ui # # RequestHeader unset X-Forwarded-For # # # END api/v3 ScriptAlias /zm/cgi-bin "/usr/libexec/zoneminder/cgi-bin" Alias /zoneminder "%ZM_WEBDIR%" Alias /zm "%ZM_WEBDIR%" Options -Indexes +MultiViews +FollowSymLinks AllowOverride None Require all granted # Refuse multipart bodies before they reach PHP: PHP parses them before # any ZoneMinder code runs (PHP2Shell, CVE-2026-109618/109619). The only # ZoneMinder feature that needs multipart is the monitor CSV import # (Add Monitors); comment this out while you use it. Require all denied # ZoneMinder does not use upload progress php_admin_flag session.upload_progress.enabled off # With mod_php, also set a fresh child per connection: the multipart block # above leaves other request bodies that can put a PHP process in a bad state # (PHP2Shell). It is server-wide, so it goes in the prefork section of # /etc/apache2/modules.d/00_mpm.conf, not here; costs a process start per # connection: # MaxConnectionsPerChild 1 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch AllowOverride All Require all granted # 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. RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] RewriteBase /zm/api RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] RewriteBase /zm/api RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] RewriteBase /zm/api # vim: ts=4 filetype=apache