Skip to content

Commit 2ad0164

Browse files
committed
Issue geerlingguy#103, PR geerlingguy#63: Add notes on basic HTTP auth.
1 parent 06a740a commit 2ad0164

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,27 @@ Set initial Apache daemon state to be enforced when this role is run. This shoul
103103

104104
If you would like to only create SSL vhosts when the vhost certificate is present (e.g. when using Let’s Encrypt), set `apache_ignore_missing_ssl_certificate` to `false`. When doing this, you might need to run your playbook more than once so all the vhosts are configured (if another part of the playbook generates the SSL certificates).
105105

106+
## .htaccess-based Basic Authorization
107+
108+
If you require Basic Auth support, you can add it either through a custom template, or by adding `extra_parameters` to a VirtualHost configuration, like so:
109+
110+
extra_parameters: |
111+
<Directory "/var/www/password-protected-directory">
112+
Require valid-user
113+
AuthType Basic
114+
AuthName "Please authenticate"
115+
AuthUserFile /var/www/password-protected-directory/.htpasswd
116+
</Directory>
117+
118+
To password protect everything within a VirtualHost directive, use the `Location` block instead of `Directory`:
119+
120+
<Location "/">
121+
Require valid-user
122+
....
123+
</Location>
124+
125+
You would need to generate/upload your own `.htpasswd` file in your own playbook. There may be other roles that support this functionality in a more integrated way.
126+
106127
## Dependencies
107128

108129
None.

0 commit comments

Comments
 (0)