Apache Authentications
Digest auth
LoadModule auth_digest_module /usr/lib/apache2/modules/mod_auth_digest.so
Alias /munin "/var/www/munin"
<Directory "/var/www/munin">
AllowOverride none
AuthType Digest
AuthName "munin"
AuthDigestProvider file
AuthUserFile /etc/apache2/munin.htpasswd
Require valid-user
</Directory>
Alias /munin "/var/www/munin"
<Directory "/var/www/munin">
AllowOverride none
AuthType Digest
AuthName "munin"
AuthDigestProvider file
AuthUserFile /etc/apache2/munin.htpasswd
Require valid-user
</Directory>
Create the digest file:
# munin below needs to match AuthName above htdigest -c /etc/apache2/munin.htpasswd munin some_user
Basic auth
One of the things that I keep forgetting, is how to setup a password for an URL.First, make sure the following is in the corresponding <Directory> directive block
AllowOverride AuthConfig
Then, create an .htaccess file in the appropriate directory, or put this under the <Directory> block in your apache config.
AuthType Basic
AuthName "Password Required"
AuthUserFile /xxx/.htpasswd
AuthGroupFile /xxx/.htgroup OR /dev/null
<Limit GET POST>
require valid-user
#require group admins
Allow from 127.0.0.1
SetEnvIf Request_URI "^/robots\.txt$" allow_this
Allow from env=allow_this
Deny from all
Satisfy Any
</Limit>
AuthName "Password Required"
AuthUserFile /xxx/.htpasswd
AuthGroupFile /xxx/.htgroup OR /dev/null
<Limit GET POST>
require valid-user
#require group admins
Allow from 127.0.0.1
SetEnvIf Request_URI "^/robots\.txt$" allow_this
Allow from env=allow_this
Deny from all
Satisfy Any
</Limit>
Then using the htpasswd utility, create the .htpasswd file
htpasswd -c .htpasswd USER_NAME
If user group is used, create the .htgroup like the following
admins: rich daniel allan
Unless you make changes in step 1, there's no need to restart apache.
There are no comments on this page. [Add comment]