apache

Password protecting website without using .htaccess

Thursday, May 22nd, 2008 | SuSE Linux, Techie, Ubuntu / Kubuntu | 1 Comment

Do you host your own website and since you have control of the /etc/apache2/conf.d directory you would rather not enable .htaccess usage?

Now you wonder how do I password protect a directory without having a .htaccess file in the directory. You actually use the same options etc you would use in a .htaccess.  So here is a sample configuration file which requires authentication for the directory /var/www/stats

Here is the location of the file below:
/etc/apache2/conf.d

<Directory /var/www/stats>
AuthType Basic
AuthName “Statistic Tracker”
AuthUserFile /etc/apache2/htpasswd.setup
Require valid-user
</Directory>

To create the required htpasswd file (with the name above) do:
sudo htpasswd -c /etc/apache2/htpasswd.setup username

Now you will have to reset apache:
sudo /etc/init.d/apache2 restart

I will be adding this to my Wiki later

Tags: , , , ,

Search

Polls

Do you think having RDP on a Linux Host important in the enterprise space?

View Results

Loading ... Loading ...

Powered by