DH_APACHE2(1)
π DH_APACHE2 π
okay bestie, gather round, because we're talking about dh_apache2 β the dh_apache2 man page, user contributed Perl documentation edition, and it's literally the helper that registers configuration snippets to the Apache web server. no cap. π
β¨ NAME β¨
dh_apache2 β register configuration snippets to the Apache web server π¦
πΈ SYNOPSIS πΈ
dh_apache2 [debhelper options] [--conditional=expression]
[--error-handler=function] [-n|--noscripts]
[-e|--noenable] [-r|--restart]
π DESCRIPTION π
so. dh_apache2 is a debhelper program, and its whole job β its main character era, honestly β is correctly installing Apache2 configuration snippets and setting postinst, prerm and dependencies in Apache2 web server modules and web applications. it ate and left no crumbs π
it supports these configuration types, and yes we're listing all of them:
- Apache2 modules π
- Apache2 configuration snippets for web applications β¨
- Apache2 sites π
and here's the tea: dh_apache2 supports two modes. either a limited auto-configuration heuristic, or a configuration file driven approach. if a file named debian/package.apache2 exists, then the actual actions are determined by that file. periodt.
π¦ OPERATION MODES π¦
dh_apache2 can be used in two modes: a configuration file driven approach and a heuristic approach. π«Ά
the configuration driven mode is fully documented in the FILES section below (scroll down bestie, it's all there). this mode gets activated by supplying a debhelper(7) configuration file, like for example debian/package.apache2.
the alternative is a heuristic mode, in which no files are installed through dh_apache2. instead, the helper will scan the package installation directory for recognized files and guess their purpose depending on their installation path in the file system. and likeβ¦ use with caution. fr fr. β οΈ
π INVOCATION π
dh_apache2 is not part of debhelper and might require information available in the apache2-dev package. packages making use of dh_apache2 should declare a build-dependency against the virtual dh-apache2 package. iykyk π
dh_apache2 supports both β being called directly from a debian/rules file, or as a dh(1) addon. in the former case, the helper should run after dh_install(1) or their respective counter parts in local implementations, at earliest. alternatively it can be used as a dh addon by invoking it with:
%:
dh $@ --with apache2
π FILES π
debian/package.apache2debian/apache2
these list files to be registered with the Apache 2 HTTP server. πΈ the file is interpreted as a line separated list of installation stanzas, where each entry consists of whitespace separated values conforming to the file semantics below.
π FILE SEMANTICS π
each line consists of a triple:
type file [arguments]
where the values are interpreted like this:
typeβ denotes the type of file to be installed. recognized values areconffor Apache2 global configuration snippets,sitefor virtual host configurations, andmodfor Apache2 modules. πfileβ interpreted as an existing file name within the source package. no path expansion is effectuated. just like dh_install(1),dh_apache2can not rename files. nope, not happening, that's not the vibe πargumentsβ interpreted as optional arguments, if any. currently used byconfstanzas only. β¨
π GLOBAL CONFIGURATION FILES π
global configuration files (determined by the conf type) must have a .conf suffix and are installed to /etc/apache2/conf-available. moreover, the configuration is activated in the maintainer script at installation time. π«Ά
such global configuration snippets are supposed to be used by web applications. such stanzas accept an optional third argument which is interpreted as a dependency line of alternative web servers the package supports. see EXAMPLES below. π
dh_apache2 will set dependencies in ${misc:Recommends} accordingly when this type of configuration is found. alternatives from the optional argument are incorporated into this dependency line. π
π¦ SITE CONFIGURATION FILES π¦
site configuration files (determined by the site type) must have a .conf suffix and are installed to /etc/apache2/sites-available. moreover, the configuration is activated in the maintainer script at installation time. β¨
such global configuration snippets are supposed to be used by web applications and third party packages which install virtual host configurations. this type of configuration sets the same dependencies as configuration files. periodt.
π MODULES π
modules are handled specially and are determined by the mod type.
modules can either have a .conf or .load suffix. in that case the file is interpreted as a module load file or a module configuration file respectively, and is installed to /etc/apache2/mods-available. π₯
if the file is ending with a .so suffix, it is interpreted as an actual module shared object and is installed to the Apache module directory. moreover, if a .load file is installed, the configuration is activated in the maintainer script at installation time. π
a typical module configuration has two lines β one for the .load file, and one for the .so file β albeit the latter could be installed by upstream's makefile, too.
dh_apache2 will set dependencies in ${misc:Depends} accordingly when this type of configuration is found. π
β¨ OPTIONS β¨
--error-handler=functionβ call the named shell function if running the maintainer script fails. the function should be provided in theprermandpostinstscripts, before the#DEBHELPER#token. π--conditional=functionβ only execute maintainer scripts if the named shell function evaluates to a true value at installation time. this is useful to web applications which want to install Apache configuration files depending on a user input, for example if they interface to the user through debconf(1). π«Ά
the default is to always execute the scripts. the named function should be provided in the prerm, postrm and postinst scripts, before the #DEBHELPER# token.
--restart -rβ in maintainer scripts, do not try to reload the web server, but restart it. otherwise the default action is used, which means global configuration and sites make the web server be reloaded on success, and modules are restarted. π-e,--noenableβ install maintainer scripts accordingly, but do not enable the scripts or configuration by default. π-n,--noscriptsβ do not modifypostinst/postrm/prermmaintainer scripts. π«
π NOTES π
note that this command is not idempotent. π dh_prep(1) should be called between invocations of this command. otherwise, it may cause multiple instances of the same text to be added to maintainer scripts. and we do not want that bestie, that's giving chaos energy.
πΈ EXAMPLES πΈ
the examples below list valid entries for a debian/package.apache2 file. β¨
for example, the two lines below install a fictional mod_foo Apache module along a Debian specific .load file:
mod src/foo/mod_foo.so
mod debian/foo.load
the example below installs a fictional web application called phpmyfoo, supplied in a package which also supports Lighttpd and nginx:
conf debian/phpmyfoo.conf lighttpd (>= 1.4.30) | nginx-full
or, the same example again, this time without support for other web servers:
conf debian/phpmyfoo.conf
as a final example, install a module called mod_foo along with a site configuration for a fictional site configuration for the site example.com:
mod src/foo/mod_foo.so
mod debian/foo.load
mod debian/foo.conf
site debian/example_com.conf
π SEE ALSO π
apache2ctl(8), a2query(8), debhelper(7), dh(1)
π AUTHOR π
this manual and dh_apache2 was written by Arno Toell <debian@toell.net>. iconic behavior honestly. π
and that's the whole page bestie!! this one's perl v5.40.1, dated 2026-10-01 β mwah, slay, go install some Apache configs πβ¨π¦
π¦ where this page comes from
- debian trixie: apache2-dev 2.4.69-1~deb13u1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms