I am trying to set up basic authentication for a linux (centos) server.
I did the following:
mkdir /usr/local/apache
mkdir /usr/local/apache/passwd
echo > /usr/local/apache/passwd/passwords
htpasswd -c /usr/local/apache/passwd/passwords some_user
new password: xxxxxx
confirm password: xxxxxx
Here's the virtual host section:
NameVirtualHost *:80
ServerName localhost
ServerAlias some.example.site.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mysite/web/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Alias /winapi /var/www/another_section/
<Directory "/var/www/another_section">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
....
Where do the basic authentication directives go? (to provide basic authentication protection to the entire virtual host):
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /usr/local/apache/passwd/passwords
Require user some_user