This howto is for Debian linux, and for Apache version 2.2. Directories and installation types may differ on other distributions.
1. Install apache module (it will also install pwauth as a dependency)
apt-get install libapache2-mod-authnz-external
2.Enable apache2 module
a2enmod authnz_external
3.Check if module is loaded:
apache2ctl -M | grep authnz_external
should see:
authnz_external_module (shared)
4. Set up vhost:
4.1: In the selected directory:
AuthType Basic
AuthName Your-Site-Name
AuthBasicProvider externalAuthExternal pwauthrequire valid-user
4.2: In the beginning of the vhost file:
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe
Possible problems:
Invalid AuthExternal keyword (pwauth)
You have no pwauth installation or you pwauth is not in the /usr/sbin directory, search it!
Action 'configtest' failed.
The Apache error log may have more information.
failed!
You have misspelled some command in the configuration file, check it!