Pages

Tuesday, November 15, 2011

htaccess (Apache Authentication)

Sometimes we may face problem with our webmail when the spam mails generated from it changing the from ID and from server itself (127.0.0.1).

In that case we may enforce a authentication to access our webmail. Lets see how we can do it.

Create a file:
vim /var/www/.htaccess


AuthType Basic
AuthName "Password Required"
AuthUserFile /var/www/webmail/.htpasswd
AuthGroupFile /dev/null
Require user test

Save and Exit.

Create another file:
vim /var/www/webmail/.htpasswd

Save and exit.

Edit the following file:
vim /etc/apache2/sites-available/default

Change AllowOverride None to AllowOverride All

Save and Exit.

Now create the password:
htpasswd -m /var/www/webmail/.htpasswd test

New password:
Re-type new password:

Now restart apache:
/etc/init.d/apache2 restart

Access your webmail address now.

No comments:

Post a Comment