Apache HTTP Server

From XennisWiki
Jump to: navigation, search

The Apache HTTP Server, commonly referred to as Apache, is a web server application notable for playing a key role in the initial growth of the World Wide Web. (Wikipedia)

Installation and configuration


Install Apache web server

sudo apt-get install apache2

Optional install apache2-utils utility programs for the web server

sudo apt-get install apache2-utils

If your browse to your server, you should see a It works HTML side. This file you find in /var/www/index.html.


The Apache configuration file is located in /etc/apache2/apache2.conf.

Helpful commands

Restart server

sudo service apache2 restart

Get Apache version

apachectl -V

Show modules

apachectl -t -D DUMP_MODULES


Prevent .git access

RedirectMatch 404 /\.git


Authentication (.htaccess)

see Webserver - Zugriffsschutz

mod_rewrite - Rewrite engine

see Rewrite engine

Problems and errors


Error when restarting the server

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using
Set the 'ServerName' directive globally to suppress this message


Add the IP address in the apache2.conf config file:


Pass the HTTP header through to Django

If Apache did not pass the HTTP header (e.g. with authentication information) correctly to Django, add the following lines to the configuration in /etc/apache2/sites-available

RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

See also

External links