Translation(s): English - Italiano - Português (Brasil) - Русский - 简体中文
The Apache HTTP Server (ə-PATCH-ee), is free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. Originally based on the NCSA HTTPd server, development of Apache began in early 1995. Apache played a key role in the initial growth of the World Wide Web, and has remained popular since.
Apache is available in Debian, among other WebServers.
Installing Apache
Modules
Debian has many modules for Apache, which package names are usually prefixed with libapache2-mod
Once installed, modules can be enabled or disabled with the commands a2enmod and a2dismod.
It seems that there are exceptions as with the module mod_evasive, this module is activated automatically .
Scripts / Dynamic content
Apache can use any external program and scripting language, through CGI or FastCgi (libapache2-mod-fcgid).
Apache can also embed some script interpreters or connect to an application server to generate dynamic content:
PHP : libapache2-mod-php
Perl : libapache2-mod-perl
Python : libapache2-mod-python, libapache2-mod-wsgi
Java/Jsp : Apache's mod_proxy_ajp (a2enmod proxy_ajp), or libapache2-mod-jk
Ruby : libapache2-mod-ruby, libapache2-mod-passenger (aka mod_rack (similar to WSGI) or mod_rails)
Lisp : libapache2-mod-lisp.
MPM selection in Debian Jessie
With Apache 2.4 in Debian Jessie the Multi-Processing Module used is no longer selected by installing one of the apache2-mpm- packages. MPM modules are enabled and disabled using the a2enmod and a2dismod commands just like with any other module. Only one MPM may be used at a time.
The default MPM used by Apache 2.4 in Jessie is mpm_event. An example of switching to mpm_worker:
a2dismod mpm_event a2enmod mpm_worker
Some modules such as libapache2-mod-php5 that require using mpm_prefork will switch to this MPM as part of the package's post installation script.
MPM selection in Debian Wheezy and earlier
Before Apache 2.4, APT would automatically select one of the four engines, usually apache2-mpm-prefork or apache2-mpm-worker (apache2-mpm-event and apache2-mpm-itk weren't recommended). The packages' description contains an overview of their differences.
Multiple Instances
The scripts apache2ctl, a2enmod, a2ensite, ... and the init script have some support for handling multiple instances of apache2 running on the same machine.
The basic idea is to copy /etc/apache2 to /etc/apache2-xxx. An example script that demonstrates what else needs to be done can be found in /usr/share/doc/apache2/examples/setup-instance. Use with:
sh /usr/share/doc/apache2/examples/setup-instance xxx
You can then use a2enmod-xxx, /etc/init.d/apache2-xxx ... as usual, and they will affect the new instance of Apache.
See /usr/share/doc/apache2/README.multiple-instances for full details.
FAQ
- Apache user (www-data)
- Debian's Apache packages come configured to run as user 'www-data'. This is potentially confusing: files to be served by apache should not be owned by 'www-data', as apache should not normally be allowed to modify them (i.e. as long as you're not running a wiki).
- Apache v1.3
Apache.org is officially encouraging users to switch to apache v2.2. DebianLenny and later releases, don't ship Apache v1.x.
(apache 1.3 release notes: "We strongly recommend that users of all earlier versions, including 1.3 family release, upgrade to to the current 2.2 version as soon as possible.")- Upgrading
- See /usr/share/doc/apache2.2-common/NEWS.Debian.gz
- Hardening
- Packaging modules
See Also
README.Debian, NEWS.Debian in the apache2.2-common package.
Search for packages related to Apache using PackageManagement tools. All related packages contain apache in their name. For example: apt-cache search apache
Manual pages in apache2, apache2-bin, apache2-utils
Debian-specific information
IRC Channel: #debian-apache on irc.debian.org (OFTC)
Teams/Apache - Debian Apache Maintainers
Bugs - Debian - BTS
Security Advisories - Debian - Security Bug Tracker
Upstream specific information