Differences between revisions 1 and 10 (spanning 9 versions)
Revision 1 as of 2020-03-03 20:55:05
Size: 1147
Comment:
Revision 10 as of 2022-09-23 16:47:38
Size: 2069
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
The 'Old Reliable' of web servers--it's sometimes even vendored as `httpd`. Can be just as fast as [[NGINXSetup|NGINX]], as long as you have a few hundred years to figure out the optimized configuration. '''`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.
Line 9: Line 9:

Line 10: Line 12:

Most Linux and BSD distributions offer a package for `httpd(8)`, but it will be named differently across systems. The most common names are `apache` and `apache2`.

Supporting programs like `htpasswd(1)` are sometimes split into a separate package named like `apache-utils`.
Line 19: Line 25:
The server is configured in `/etc/apache2.conf`. This file requires little intervention, while site-specific configurations are included. The server is configured by a central file. Distributions disagree about the correct location for this file. Try all of the following:
Line 21: Line 27:
   * `/etc/apache2.conf`
 * `/etc/apache2/apache2.conf`
 * `/etc/httpd/conf/httpd.conf`
 * `/usr/local/etc/apache/httpd.conf`

Line 25: Line 36:
Virtual hosts are declared in domain-specific files. An example site configuration, for [[CGITSetup|CGit]]. Virtual hosts are declared in domain-specific files. An example site configuration for a CGI script, such as [[CGit|cgit]].
Line 33: Line 44:
  Alias /cgit-css /usr/share/cgit
Line 35: Line 45:
Line 49: Line 60:
=== Restricting Access === === 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 (HTTP'''S''').

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.


Installation

Most Linux and BSD distributions offer a package for httpd(8), but it will be named differently across systems. The most common names are apache and apache2.

Supporting programs like htpasswd(1) are sometimes split into a separate package named like apache-utils.


Configuration

Server

The server is configured by a central file. Distributions disagree about the correct location for this file. Try all of the following:

  • /etc/apache2.conf

  • /etc/apache2/apache2.conf

  • /etc/httpd/conf/httpd.conf

  • /usr/local/etc/apache/httpd.conf

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).


CategoryRicottone

Apache (last edited 2023-04-03 12:48:41 by DominicRicottone)