But it is not safe because anyone can browse the content under /var/www by typing
http://ip_address
Nix told me that I can setup the Apache to make the password prompt!
The following is my steps under Unbutu feisty, where the Apache version 2.2.3-4
1. Basic Authentiation
# vi /etc/apache2/apache2.conf
add the following block
-----------------------------------
<Directory /var/www>
AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
AuthUserFile /etc/apache2/web_password
Required user the_user
-------------------------------------
then
# htpasswd -c web_password the_user
# apache2ctl restart
to create the password
But the basic method transfer the password by the plain text, I try the second method
2. Digest Authentication
Add the following block in /etc/apache2/apache2.conf
AuthType Digest
AuthName "Private"
AuthDigestDomain "/" http://ip_address
AuthDigestFile /etc/apache2/webdigest
Require valid-user
--------------------------------------
Check if the auth_digest.load exists in /etc/apache2/mods-enabled
# ls /etc/apache2/mods-enabled
if no, create a symbolic link
# ln -s /etc/apache2/mods-available/auth_digest.load /etc/apache2/mods-enabled/auth_digest.load
Create the digest password:
# htdigest -c webdigest Private username
I am not sure the meaning of Private, it seems have to be the same as the one specified in AuthName in apache2.conf.
And the meaining of Location still needs investigation!
沒有留言:
張貼留言