Apache
httpd(8), also known as Apache or Apache2, is one of the oldest and most extensible web servers. It has survived so long precisely because it is so extensible; system administrators have been able to continuously tune and upgrade the server for modern best practices.
Contents
Installation
Configuration
Server
The server is configured in /etc/apache2.conf. This file requires little intervention, while site-specific configurations are included.
Sites
Virtual hosts are declared in domain-specific files. An example site configuration for a CGI script, such as cgit.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName git.my-domain.com
DocumentRoot /usr/share/cgit
Alias / /usr/share/cgit/cgit.cgi
<Document '/usr/share/cgit/'>
Options ExecCGI FollowSymLinks
Require all granted
AddHandler cgi-script .cgi
DirectoryIndex cgit.cgi
</Document>
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Authentication
A document can be set to require authentication, except for a local network user.
<Document "/">
AuthType Basic
AuthName "Authentication Required"
AuthUserFile /var/www/ftp-htpasswd
<RequireAny>
Require valid-user
Require ip 192.168
Require ip 10
</RequireAny>
</Document>This method of authentication is 'good-enough' for personal uses. It relies entirely on the traffic encryption (HTTPS).
