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, Apache HTTP Server)

Installation and configuration

Install

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.

Configuration

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

Module

Authentication (.htaccess)

see Webserver - Zugriffsschutz

mod_rewrite - Rewrite engine

see Rewrite engine

Problems and errors

ServerName

Error when restarting the server

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

Solution

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

ServerName IP-ADDRESS

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